/*
Handler for hook: ParserFirstCallInit

Register the Skinny parser functions
331577
public static function ParserFirstCallInit(&$parser){
    $parser->setFunctionHook('movetoskin', 'Skinny::moveToSkinPF');
    $parser->setFunctionHook('setskin', 'Skinny::setSkinPF');
    $parser->setFunctionHook('layout', 'Skinny::setLayoutPF');
    $parser->setFunctionHook('skinsert', 'Skinny::insertTemplatePF');
    $parser->setFunctionHook('imageurl', 'Skinny::getImageURLPF');

    return true;
  }
318992
def register_hooks(func, hooks, obj):
    
    for name, args, kwargs in hooks:
        hook = getattr(obj, name)
        force_call = kwargs.pop("_force_call", False)
        if force_call or len(args) > 0 or len(kwargs) > 0:
            hook = hook(*args, **kwargs)
        hook(func)
1094956
def _register_hook(hook_name, target, func, *args, **kwargs):
    
    call = (func, args, kwargs)
    try:
        getattr(target, hook_name).append(call)
    except AttributeError:
        setattr(target, hook_name, [call])
763351
function tryWrapper(handler) {
    for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        args[_key - 1] = arguments[_key];
    }

    try {
        handler.apply(undefined, args);
    } catch (err) {
        console.error("handler received an error: " + err.message + ", " + JSON.stringify(err));
    }
}
1138810
protected function registerBufferEmptyCallback()
    {
        $this->swoolePort->on('BufferEmpty', function ($server, $fd) {
            $this->dispatchEvent('BufferEmpty', $this->server, $this, $fd);
        });
    }
1085519
protected void afterParserOrEnumRuleCall() {
	ICompositeNode newCurrent = nodeBuilder.compressAndReturnParent(currentNode);
	if(currentNode == lastConsumedNode){
		lastConsumedNode = newCurrent;
	}
		currentNode = newCurrent;
    }
500641
function Parser(stream) {
  StreamStack.call(this, stream, {
    data: function(b) { this._onData(b); }
  });
  this._onData = this._parseHeader;
  this._headerParser = new HeaderParser(new Stream(), {
    emitFirstLine: false,
    strictCRLF: false,
    strictSpaceAfterColon: false,
    allowFoldedHeaders: false
  });
  this._headerParser.on('headers', this._onHeadersComplete.bind(this));
}
755571
private void setupParser ()
    {
    // catch an illegal "nonsense" state.
    if (!prefixes && !namespaces)
        throw new IllegalStateException ();

    nsSupport.reset();
    if (uris)
        nsSupport.setNamespaceDeclUris (true);

    if (entityResolver != null) {
        parser.setEntityResolver(entityResolver);
    }
    if (dtdHandler != null) {
        parser.setDTDHandler(dtdHandler);
    }
    if (errorHandler != null) {
        parser.setErrorHandler(errorHandler);
    }
    parser.setDocumentHandler(this);
    locator = null;
    }
1019936
function addFunction(func, sig) {
  if (typeof sig === 'undefined') {
    Module.printErr('Warning: addFunction: Provide a wasm function signature ' +
                    'string as a second argument');
  }
  var base = 0;
  for (var i = base; i < base + 0; i++) {
    if (!functionPointers[i]) {
      functionPointers[i] = func;
      return jsCallStartIndex + i;
    }
  }
  throw 'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.';
}
1246637
function simpleparser (options) {
  var parameterLimit = options.parameterLimit !== undefined
    ? options.parameterLimit
    : 1000
  var parse = parser('querystring')

  if (isNaN(parameterLimit) || parameterLimit < 1) {
    throw new TypeError('option parameterLimit must be a positive number')
  }

  if (isFinite(parameterLimit)) {
    parameterLimit = parameterLimit | 0
  }

  return function queryparse (body) {
    var paramCount = parameterCount(body, parameterLimit)

    if (paramCount === undefined) {
      debug('too many parameters')
      throw createError(413, 'too many parameters')
    }

    debug('parse urlencoding')
    return parse(body, undefined, undefined, {maxKeys: parameterLimit})
  }
}
668845
def call_parse(func):
    ""
    name = inspect.currentframe().f_back.f_globals['__name__']
    if name == "__main__":
        args = anno_parser(func).parse_args()
        func(**args.__dict__)
    else: return func
881058
function callNormalizedCallback (callback, arg) {
        callback.fn.call(callback.scope, arg, callback.args);
    }
577442
function parse(fileString, callback) {
	try {
		return callback(null, Yaml.safeLoad(fileString));
	} catch (err) {
		return callback(err);
	}
}
767116
function first (callback) {
        if (typeof callback !== 'function') {
          throw new Error('Callback must be a function, instead got: ' + (typeof callback));
        }

        function firstCallback (result) {
          callback(result);
          unbind('start', firstCallback);
        }

        bind('start', firstCallback);
        bind('stop', unbind.bind(null, 'end', firstCallback));

        return self;
      }
754836
public function registerParser($pluginName, $parser, $regexp = null, $limit = PHP_INT_MAX)
	{
		if (!is_callable($parser))
		{
			throw new InvalidArgumentException('Argument 1 passed to ' . __METHOD__ . ' must be a valid callback');
		}
		// Create an empty config for this plugin to ensure it is executed
		if (!isset($this->pluginsConfig[$pluginName]))
		{
			$this->pluginsConfig[$pluginName] = [];
		}
		if (isset($regexp))
		{
			$this->pluginsConfig[$pluginName]['regexp']      = $regexp;
			$this->pluginsConfig[$pluginName]['regexpLimit'] = $limit;
		}
		$this->pluginParsers[$pluginName] = $parser;
	}
355235
function _data_handler($parser, $data)
    {
        if (!isset($this->current) || is_object($this->current)) {
            return;
        }
        $this->current.= trim($data);
    }
281525
def on_resolve(target, func, *args, **kwargs):
    
    return _register_hook(ON_RESOLVE, target, func, *args, **kwargs)