Parser(a, b) -> Parser(a, [b])

    Returns a parser that infinitely applies the parser p to the input sequence
    of tokens while it successfully parsers them. The resulting parser returns a
    list of parsed values.
960258
def many(p):
    

    @Parser
    def _many(tokens, s):
        """Iterative implementation preventing the stack overflow."""
        res = []
        try:
            while True:
                (v, s) = p.run(tokens, s)
                res.append(v)
        except NoParseError, e:
            return res, State(s.pos, e.state.max)

    _many.name = u'{ %s }' % p.name
    return _many
1173162
def p_parse(cls, input, methodname=None, parse_all=True):
        
        if methodname is None:
            methodname = cls.__default__
        p = cls(input)
        result = getattr(p, methodname)()
        if result is cls.NoMatch or parse_all and p.p_peek() is not None:
            p.p_raise()
        return result
673973
function Parser(str, opts) {
  this._oneWayVoid = !!(opts && opts.oneWayVoid);
  this._reassignJavadoc = !!(opts && opts.reassignJavadoc);
  this._imports = [];
  this._tk = new Tokenizer(str);
  this._tk.next(); // Prime tokenizer.
}
1241392
def init(parser = None):
    

    global p,subparsers
    if parser is None:
        p = argparse.ArgumentParser()
    else:
        p = parser

    arg = p.add_argument

    subparsers = p.add_subparsers()
801250
private static List<String> parseList(String input, String delim) {
        List<String> result = new ArrayList<>();

        StringTokenizer st = new StringTokenizer(input, delim);
        while (st.hasMoreTokens()) {
            String token = st.nextToken().trim();
            if (token.length() > 0) {
                result.add(token);
            }
        }

        return result;
    }
297835
public Parse parse(Parse tokens) {
    Parse p = parse(tokens,1)[0];
    setParents(p);
    return p;
  }
949987
def custom_parser(cards: list, parser: Optional[Callable[[list], Optional[list]]]=None) -> Optional[list]:
    ''''''

    if not parser:
        return cards

    else:
        return parser(cards)
641138
public boolean match(ParserTokenType expected) {
      ParserToken next = lookAhead(0);
      if (next == null || !next.type.isInstance(expected)) {
         return false;
      }
      consume();
      return true;
   }
874627
def parse(cls, parser, token):
        
        # Process the template line.
        tag_name, args, kwargs = parse_token_kwargs(
            parser, token,
            allowed_kwargs=cls.allowed_kwargs,
            compile_args=False,  # Only overrule here, keep at render() phase.
            compile_kwargs=cls.compile_kwargs
        )

        # remove "for" keyword, so all other args can be resolved in render().
        if args[0] == 'for':
            args.pop(0)

        # And apply the compilation afterwards
        for i in range(len(args)):
            args[i] = parser.compile_filter(args[i])

        cls.validate_args(tag_name, *args, **kwargs)
        return cls(tag_name, *args, **kwargs)
410085
def _get_parsers(self, name):
        

        parserlist = BaseParser.__subclasses__()
        forced = name is None

        if isinstance(name, (six.text_type, six.binary_type)):
            parserlist = [p for p in parserlist if p.__name__ == name]
            if not parserlist:
                raise ValueError("could not find parser: {}".format(name))

        elif name is not None:
            raise TypeError("parser must be {types} or None, not {actual}".format(
                types=" or ".join([six.text_type.__name__, six.binary_type.__name__]),
                actual=type(parser).__name__,
            ))

        return not forced, parserlist
277202
def parser(self):
        '''
        
        '''
        if not hasattr(self, '_parser'):
            self._parser = self._compile()
        return self._parser
29063
def choice(self, other):
        ''''''
        @Parser
        def choice_parser(text, index):
            res = self(text, index)
            return res if res.status or res.index != index else other(text, index)
        return choice_parser
1236196
@Deprecated
  public static <A,B,C,D> Parser<Tuple4<A,B,C,D>> tuple(
      Parser<? extends A> p1, Parser<? extends B> p2,
      Parser<? extends C> p3, Parser<? extends D> p4) {
    return sequence(p1, p2, p3, p4, Tuple4::new);
  }
45867
function Parser() {
  if (!(this instanceof Parser))
    return new Parser();

  EventEmitter.call(this);

  this.waiting = 9;
  this.header = null;
  this.pending = [];
  this.total = 0;
}
226518
def ends_with(self, other):
        ''''''
        @Parser
        def ends_with_parser(text, index):
            res = self(text, index)
            if not res.status:
                return res
            end = other(text, res.index)
            if end.status:
                return res
            else:
                return Value.failure(end.index, 'ends with {}'.format(end.expected))
        return ends_with_parser
174611
def parse(self):
        
        try:
            # Continues until `next_line()` raises StopIteration
            # This can trigger here or in parse functions in the subclass
            while True:
                # Only advance the parser if the previous line was consumed.
                # Parse functions reading multiple lines can end up reading one line too far,
                # so they return without consuming the line and we pick it up here
                if not self.line:
                    self.next_line()

                if self.line[0] == '#' or len(self.values) < 2:
                    self.consume_line()
                    continue

                self.dispatcher.get(self.values[0], self.parse_fallback)()
        except StopIteration:
            pass

        if self.auto_post_parse:
            self.post_parse()
419534
def invoke_parser(self, supparser=None, noexit=False):
        
        if supparser:
            parser = supparser.add_parser(self.NAME, description=self.DESCRIPTION)
        else:
            if noexit:
                class NoExitArgumentParser(argparse.ArgumentParser):
                    def exit(self, status=0, message=None):
                        raise ParserError()
                    def error(self, message):
                        raise ParserError()

                parser = NoExitArgumentParser(prog=self.NAME, description=self.DESCRIPTION)
            else:
                parser = argparse.ArgumentParser(prog=self.NAME, description=self.DESCRIPTION)


        def populate_parser(parser, dataset):
            for elem in dataset:
                opts = {}
                opts['help'] = elem.description
                opts['required'] = not elem.optional
                if elem.multi: opts['action'] = 'append'
                parser.add_argument('--'+elem.name, **opts)

        # populate parser with INPUTS
        populate_parser(parser, self.INPUTS)
        # populate parser with OUTPUTS
        populate_parser(parser, self.OUTPUTS)
        # populate parser with PARAMETERS
        for param in self.PARAMETERS:
            opts = {}
            opts['help'] = param.description
            opts['required'] = not param.optional
            if isinstance(param.datatype, tuple):
                opts['type'] = str
                #opts['type'] = param.datatype[1]
            else:
                opts['type'] = param.datatype

            if param.multi: opts['action'] = 'append'
            if param.choices:
                if isinstance(param.choices, tuple):
                    # if choices is a tuple, assume it is a tuple of mappings
                    # and expand them
                    opts['choices'] = [ choice[0] for choice in param.choices ]
                else:
                    opts['choices'] = param.choices
            parser.add_argument('--'+param.name, **opts)

        if self.USE_ARGUMENTS:
            parser.add_argument('--_tempdir',required=False, help=argparse.SUPPRESS)
        return parser