pattern function

Parser<String> pattern (
  1. String element,
  2. [String message]
)

Returns a parser that accepts the given character class pattern.

Implementation

Parser<String> pattern(String element, [String message]) {
  return CharacterParser(pattern_.parse(element).value,
      message ?? '[${toReadableString(element)}] expected');
}