Optionaloptions: ErrorOptionsReadonlycharacterThe offending text — a single character for UNEXPECTED_CHARACTER (the
whole code point, so astral symbols are not split into surrogates), or
the unrecognized word for UNEXPECTED_IDENTIFIER.
Not guaranteed to appear in message — errors that name a rule rather than
a character leave it out.
ReadonlycodeStable programmatic identifier for the failure. Branch on this rather
than on message, which is free to change between releases.
ReadonlypositionZero-based UTF-16 offset of the offending character in the input.
Error thrown when the lexer encounters an invalid character.
positionis a zero-based UTF-16 offset into the input. It is deliberately absent frommessage— read it from the field, or uniformly across all roll-parser errors viagetErrorSpan.Codes:
UNEXPECTED_CHARACTERfor a character that cannot start any token,UNEXPECTED_IDENTIFIERfor a word that is not a known keyword.Example