@Override public Parser<T> label(String name) { return Parser.this.label(name).peek(); } @Override boolean apply(ParseContext ctxt) {
/** * A {@link Parser} that fails if {@code this} succeeds. Any input consumption is undone. * * @param unexpected the name of what we don't expect. */ public final Parser<?> not(String unexpected) { return peek().ifelse(Parsers.unexpected(unexpected), Parsers.always()); }
/** * A {@link Parser} that matches this parser zero or many times * until the given parser succeeds. The input that matches the given parser * will not be consumed. The input that matches this parser will * be collected in a list that will be returned by this function. * * @since 2.2 */ public final Parser<List<T>> until(Parser<?> parser) { return parser.not().next(this).many().followedBy(parser.peek()); }