Esempio n. 1
0
            internal override InternalResult <T> Parse(IParseState <TToken> state)
            {
                state.PushBookmark();

                var result = _parser.Parse(state);

                if (result.Success)
                {
                    state.Rewind();
                    return(InternalResult.Success <T>(result.Value, false));
                }
                state.PopBookmark();
                return(result);
            }
Esempio n. 2
0
            internal sealed override InternalResult <T> Parse(IParseState <TToken> state)
            {
                // start buffering the input
                state.PushBookmark();
                var result = _parser.Parse(state);

                if (!result.Success)
                {
                    // return to the start of the buffer and discard the bookmark
                    state.Rewind();
                    return(InternalResult.Failure <T>(false));
                }

                // discard the buffer
                state.PopBookmark();
                return(result);
            }