Parser { public final Parser<T> followedBy(Parser<?> parser) { return Parsers.sequence(this, parser, InternalFunctors.<T, Object>firstOfTwo()); } Parser(); static Reference<T> newReference(); final Parser<R> retn(R value); final Parser<R> next(Parser<R> parser); final Parser<To> next(
      final Function<? super T, ? extends Parser<? extends To>> map); final Parser<List<T>> until(Parser<?> parser); final Parser<T> followedBy(Parser<?> parser); final Parser<T> notFollowedBy(Parser<?> parser); final Parser<List<T>> many(); final Parser<Void> skipMany(); final Parser<List<T>> many1(); final Parser<Void> skipMany1(); final Parser<List<T>> atLeast(int min); final Parser<Void> skipAtLeast(int min); final Parser<Void> skipTimes(int n); final Parser<List<T>> times(int n); final Parser<List<T>> times(int min, int max); final Parser<Void> skipTimes(int min, int max); final Parser<R> map(final Function<? super T, ? extends R> map); final Parser<T> or(Parser<? extends T> alternative); final Parser<T> otherwise(Parser<? extends T> fallback); @Deprecated final Parser<T> optional(); final Parser<Optional<T>> asOptional(); final Parser<T> optional(T defaultValue); final Parser<?> not(); final Parser<?> not(String unexpected); final Parser<T> peek(); final Parser<T> atomic(); final Parser<Boolean> succeeds(); final Parser<Boolean> fails(); final Parser<R> ifelse(Parser<? extends R> consequence, Parser<? extends R> alternative); final Parser<R> ifelse(
      final Function<? super T, ? extends Parser<? extends R>> consequence,
      final Parser<? extends R> alternative); Parser<T> label(final String name); @SuppressWarnings("unchecked") final Parser<R> cast(); final Parser<T> between(Parser<?> before, Parser<?> after); @Deprecated final Parser<T> reluctantBetween(Parser<?> before, Parser<?> after); final Parser<List<T>> sepBy1(Parser<?> delim); final Parser<List<T>> sepBy(Parser<?> delim); final Parser<List<T>> endBy(Parser<?> delim); final Parser<List<T>> endBy1(Parser<?> delim); final Parser<List<T>> sepEndBy1(final Parser<?> delim); final Parser<List<T>> sepEndBy(Parser<?> delim); final Parser<T> prefix(Parser<? extends Function<? super T, ? extends T>> op); final Parser<T> postfix(Parser<? extends Function<? super T, ? extends T>> op); final Parser<T> infixn(Parser<? extends BiFunction<? super T, ? super T, ? extends T>> op); final Parser<T> infixl(
      Parser<? extends BiFunction<? super T, ? super T, ? extends T>> operator); final Parser<T> infixr(Parser<? extends BiFunction<? super T, ? super T, ? extends T>> op); final Parser<Token> token(); final Parser<String> source(); final Parser<WithSource<T>> withSource(); final Parser<T> from(Parser<? extends Collection<Token>> lexer); final Parser<T> from(Parser<?> tokenizer, Parser<Void> delim); Parser<List<Token>> lexer(Parser<?> delim); final T parse(CharSequence source); final T parse(Readable readable); final T parse(CharSequence source, Mode mode); final ParseTree parseTree(CharSequence source); @Deprecated final T parse(CharSequence source, String moduleName); @Deprecated final T parse(Readable readable, String moduleName);  }
@Test public void testFollowedBy() { assertEquals((Object) 123, INTEGER.followedBy(COMMA).parse("123,", mode)); assertFailure(mode, FAILURE.followedBy(FOO), "", 1, 1, "failure"); assertFailure(mode, INTEGER.followedBy(COMMA), "123", 1, 4, ", expected, EOF encountered."); }