Defines a parser wrapped into this object.
197809
def define(self, p):
        """"""
        f = getattr(p, 'run', p)
        if debug:
            setattr(self, '_run', f)
        else:
            setattr(self, 'run', f)
        self.named(getattr(p, 'name', p.__doc__))
469692
def parser(description=None, usage=None):
    """"""

    class ArgNamespace(object):
        def __init__(self, result):
            self._result = result

        def __getattr__(self, name):
            try:
                super(ArgNamespace, self).__getattr__(name)
            except AttributeError:
                return getattr(self._result, name)

        def arg_strings(self, name=None):
            if not self._result:
                return None
            return extract_strings(self._result.__dict__, name)

    class ArgParser(object):

        def __init__(self, argument_parser):
            self.parser = argument_parser
            self.parse = self.parse_args
            self._parsed = None

            self.arg = self.parser.add_argument
            self.opt = self.true = partial(self.arg, action='store_true')
            self.int = partial(self.arg, type=int)

        def parse_args(self):
            return ArgNamespace(self.parser.parse_args())

        def sub(self, name, help=''):
            self.arg(name, metavar=name, help=help, type=str)

        def args(self, name, help='', many='*'):
            self.arg(name, metavar=name, help=help, type=str, nargs=many)

        def answer(self, answers=None):
            yes_no = {
                'n': ('-n', '--no', 'Answer no'),
                'y': ('-y', '--yes', 'Answer yes'),
            }
            options = yes_no
            options.update(answers)
            [self.true(options[o]) for o in options]

    lines = description.splitlines()
    if not usage:
        if len(lines) > 1 and not lines[1]:
            usage, epilog = lines[0], '\n\n'.join(lines[2:])
    else:
        usage = description = lines[0]
        epilog = None
    return ArgParser(
        argparse.ArgumentParser(usage=description))
239781
def parameter(self, parser):
        
        return (Suppress(self.syntax.params_start).leaveWhitespace() +
                Group(parser) + Suppress(self.syntax.params_stop))
750224
def parse(self):
        """"""
        if self.parser is None:
            self.makeParser()
        self.args = self.parser.parse_args()
        self.verbose = self.args.verbose
1229347
def register_parser(self, type, parser, **meta):
        
        try:
            self.registered_formats[type]['parser'] = parser
        except KeyError:
            self.registered_formats[type] = {'parser': parser}
        if meta:
            self.register_meta(type, **meta)
997188
function parser(tokens) {
  // add Close token before each Else
  const toks = tokens.reduce((prev, tok) => {
    if (tok.tokenType === 'Else') {
      return [...prev, new Close(), tok];
    }

    return [...prev, tok];
  }, []);

  const [body] = parse(toks, '', 1);
  return body;
}
812046
public void define() {
		staticInitializer = null;
		haveLookedForStaticInitializer = false;
		// DEFAULT METHODS - remove the if
		if (!typeDescriptor.isInterface()) {
			try {
				dispatcherClass = reloadableType.typeRegistry.defineClass(dispatcherName, dispatcher, false);
			}
			catch (RuntimeException t) {
				// TODO check for something strange.  something to do with the file detection misbehaving, see the same file attempted to be reloaded twice...
				if (t.getMessage().indexOf("duplicate class definition") == -1) {
					throw t;
				}
				else {
					t.printStackTrace();
				}
			}
		}
		try {
			executorClass = reloadableType.typeRegistry.defineClass(executorName, executor, false);
		}
		catch (RuntimeException t) {
			// TODO check for something strange.  something to do with the file detection misbehaving, see the same file attempted to be reloaded twice...
			if (t.getMessage().indexOf("duplicate class definition") == -1) {
				throw t;
			}
			else {
				t.printStackTrace();
			}
		}
		// DEFAULT METHODS - remove the if
		if (!typeDescriptor.isInterface()) {
			try {
				dispatcherInstance = dispatcherClass.newInstance();
			}
			catch (InstantiationException e) {
				throw new RuntimeException("Unable to build dispatcher class instance", e);
			}
			catch (IllegalAccessException e) {
				throw new RuntimeException("Unable to build dispatcher class instance", e);
			}
		}
	}
911856
def parse_definition(lexer: Lexer) -> DefinitionNode:
    """"""
    if peek(lexer, TokenKind.NAME):
        func = _parse_definition_functions.get(cast(str, lexer.token.value))
        if func:
            return func(lexer)
    elif peek(lexer, TokenKind.BRACE_L):
        return parse_executable_definition(lexer)
    elif peek_description(lexer):
        return parse_type_system_definition(lexer)
    raise unexpected(lexer)
487068
def add_to_parser(self, parser):
        
        setts = self.settings

        def sorter(x):
            return (setts[x].section, setts[x].order)

        for k in sorted(setts, key=sorter):
            setts[k].add_argument(parser)
        return parser
1257419
function Parser() {
  this.internalParser = new JsonParser();
  this.originalOnToken = this.internalParser.onToken;
  this.internalParser.onToken = onToken.bind(this);
  return this.internalParser;
}
662719
function ParserContent () {
	// Parser reference
	var self = this
	// Current row
	var data = []

	// Define the parser rules
	var eol = ['\n','\r\n']
	var sep = options.separator || ','
	// Handlers are used instead of events
	atok
	    // Ignore comments
	    .ignore(true) // On rule match, do not do anything, skip the token
	        .addRule('#', eol, 'comment')
	    .ignore() // Turn the ignore property off
	    // Anything else is data
	    // Rule definition:
	    // first argument: always an exact match. To match anything, use ''
	    // next arguments: array of possible matches (first match wins)
	    .addRule('', { firstOf: [ sep ].concat(eol) }, function (token, idx) {
	        // token=the matched data
	        // idx=when using array of patterns, the index of the matched pattern
	        if (token === 'error') {
	            // Build the error message using positioning
	            var err = self.trackError(new Error('Dummy message'), token)
	            self.emit('error', err)
	            return
	        }
	        // Add the data
	        data.push(token)
	        // EOL reached, the parser emits the row
	        if (idx > 0) {
	            self.emit('data', data)
	            data = []
	        }
	    })
}
15800
public Grammar register(@NonNull ParserTokenType type, @NonNull PrefixHandler handler) {
      prefixHandlers.put(type, handler);
      return this;
   }
299723
public function parse()
    {
        $this->parser->parse($this->rawArguments);
        $this->parsed = true;
        $this->arguments = $this->parser->getArguments();
        $optionsShort = $this->parser->getOptionsShort();
        $optionsLong = $this->parser->getOptionsLong();
        $missongRequired = array();
        foreach ($this->optionDefinitions as $definition) {
            $value = $this->getOptionValue($definition);
            $short = $definition->getShort();
            $long = $definition->getLong();
            $optionsShort[$short] = $value;
            $optionsLong[$long] = $value;
            if ($definition->getRequired() && $value === null) {
                $parts = array();
                $parts[] = $short !== null ? '-' . $short : null;
                $parts[] = $long !== null ? '--' . $long : null;
                $missongRequired[] = implode('|', $parts);
            }
        }
        if (!empty($missongRequired)) {
            throw new GetoptException(
                'Missing required options: '
                . implode(', ', $missongRequired)
            );
        }
        $this->optionsShort = $optionsShort;
        $this->optionsLong = $optionsLong;
    }
499799
function ParserBlock() {
  /**
   * ParserBlock#ruler -> Ruler
   *
   * [[Ruler]] instance. Keep configuration of block rules.
   **/
  this.ruler = new Ruler();

  for (var i = 0; i < _rules.length; i++) {
    this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() });
  }
}
324517
def registerParser(self, parser):
        

        if not isinstance(parser, Subparser):
            raise TypeError("%s is not an instance of a subparser." % parser)

        self.parsers.append(parser)
1324151
def _subclass(self, parser):
        '''
         
        '''
        _set(self, '_sub', parser._create(memoryview(getattr(self, '_extra', b'')), self._target))
        try:
            object.__delattr__(self, '_extra')
        except:
            pass
772999
def parser(*events):
    """"""
    def dec(func):
        for event in events:
            PARSERS[event] = func
        return func
    return dec