Module unescape

Source
Expand description

Utilities for validating string and char literals and turning them into values they represent.

Enumsยง

EscapeError
Errors and warnings that can occur during string unescaping. They mostly relate to malformed escape sequences, but there are a few that are about other problems.
MixedUnit
Used for mixed utf8 string literals, i.e. those that allow both unicode chars and high bytes.
Mode
What kind of literal do we parse.

Functionsยง

ascii_check ๐Ÿ”’
byte_from_char
check_raw_common ๐Ÿ”’
Takes a contents of a string literal (without quotes) and produces a sequence of characters or errors. NOTE: Raw strings do not perform any explicit character escaping, here we only produce errors on bare CR.
scan_escape ๐Ÿ”’
scan_unicode ๐Ÿ”’
skip_ascii_whitespace ๐Ÿ”’
unescape_byte
Takes a contents of a byte literal (without quotes), and returns an unescaped byte or an error.
unescape_char
Takes a contents of a char literal (without quotes), and returns an unescaped char or an error.
unescape_char_or_byte ๐Ÿ”’
unescape_mixed
Takes the contents of a mixed-utf8 literal (without quotes) and produces a sequence of escaped characters or errors.
unescape_non_raw_common ๐Ÿ”’
Takes a contents of a string literal (without quotes) and produces a sequence of escaped characters or errors.
unescape_unicode
Takes the contents of a unicode-only (non-mixed-utf8) literal (without quotes) and produces a sequence of escaped characters or errors.