not method

  1. @useResult
Parser<Failure> not([
  1. String message = 'success not expected'
])

Returns a parser (logical not-predicate) that succeeds with the Failure whenever the receiver fails, but never consumes input.

For example, the parser char('_').not().seq(identifier) accepts identifiers that do not start with an underscore character. If the parser char('_') accepts the input, the negation and subsequently the complete parser fails. Otherwise the parser identifier is given the ability to process the complete identifier.

Implementation

@useResult
Parser<Failure> not([String message = 'success not expected']) =>
    NotParser(this, message);