end method

  1. @useResult
Parser<R> end([
  1. String message = 'end of input expected'
])

Returns a parser that succeeds only if the receiver consumes the complete input, otherwise return a failure with the optional message.

For example, the parser letter().end() succeeds on the input 'a' and fails on 'ab'. In contrast the parser letter() alone would succeed on both inputs, but not consume everything for the second input.

Implementation

@useResult
Parser<R> end([String message = 'end of input expected']) =>
    skip(after: endOfInput(message));