char function

Parser<String> char (
  1. Object char,
  2. [String message]
)

Returns a parser that accepts a specific character only.

Implementation

Parser<String> char(Object char, [String message]) {
  return CharacterParser(SingleCharPredicate(toCharCode(char)),
      message ?? '"${toReadableString(char)}" expected');
}