tomlNonAscii top-level property

Parser<String> tomlNonAscii
final

Parser for non-ASCII characters that are allowed in TOML comments and literal strings.

non-ascii = %x80-D7FF / %xE000-10FFFF

The subrange %x10000-10FFFF is represented as surrogate pairs by Dart. Since petitparser can only work with 16-Bit code units, we have to parse the surrogate pairs manually.

Implementation

final Parser<String> tomlNonAscii = ChoiceParser([
  range('\x80', '\uD7FF'),
  range('\uE000', '\uFFFF'),
  _tomlSurrogatePair,
]);