@NotNull @Override public Pair<R2, State> parse(@NotNull List<Token<T>> tokens, @NotNull State state) throws ParserException { final Pair<R, State> result = myParser.parse(tokens, state); return Pair.create(myFunction.fun(result.getFirst()), result.getSecond()); }
@NotNull @Override public Pair<R, State> parse(@NotNull List<Token<T>> tokens, @NotNull State state) throws ParserException { try { return myFirst.parse(tokens, state); } catch (ParserException e) { return mySecond.parse(tokens, new State(state, state.getPos(), e.getState().getMax())); } }