neg method
Returns a parser that consumes any input token (character), but the receiver.
For example, the parser letter().neg()
accepts any input but a letter.
The parser fails for inputs like 'a'
or 'Z'
, but succeeds for
input like '1'
, '_'
or '$'
.
Implementation
Parser<String> neg([String message = 'input not expected']) =>
[not(message), any()].toSequenceParser().pick(1).cast<String>();