rustc_lexer

Module unescape

source
Expand description

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

Enumsยง

  • 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.
  • Used for mixed utf8 string literals, i.e. those that allow both unicode chars and high bytes.
  • What kind of literal do we parse.

Functionsยง

  • ascii_check ๐Ÿ”’
  • 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 ๐Ÿ”’
  • Takes a contents of a byte literal (without quotes), and returns an unescaped byte or an error.
  • Takes a contents of a char literal (without quotes), and returns an unescaped char or an error.
  • Takes the contents of a mixed-utf8 literal (without quotes) and produces a sequence of escaped characters or errors.
  • Takes a contents of a string literal (without quotes) and produces a sequence of escaped characters or errors.
  • Takes the contents of a unicode-only (non-mixed-utf8) literal (without quotes) and produces a sequence of escaped characters or errors.