Skip to content

Conversation

narpfel
Copy link

@narpfel narpfel commented Mar 15, 2025

There are a few cases where the current escape sequence parser is inaccurate, which causes misleading syntax highlighting.

  • hexadecimal-escape-sequence does not have a maximum length, so '\x00000000a' is the same as '\n'. Godbolt link: https://godbolt.org/z/fq18PbPc4
  • octal-escape-sequence can only contain octal digits [0-7], so "\749" is "<9" and the 9 should not be highlighted as part of the escape sequence. Godbolt link: https://godbolt.org/z/rEcM88had
  • Any other character except the valid escape sequence characters are not allowed in escape sequences, so they should not be highlighted as escape sequences. This PR introduces invalid_escape_sequence so that invalid escape sequences can be highlighted.

There are a few cases where the current escape sequence parser is inaccurate,
which causes misleading syntax highlighting.

* `hexadecimal-escape-sequence` does not have a maximum length, so `'\x00000000a'`
  is the same as `'\n'`. Godbolt link: https://godbolt.org/z/fq18PbPc4
* `octal-escape-sequence` can only contain octal digits `[0-7]`, so `"\749"`
  is `"<9"` and the `9` should not be highlighted as part of the escape sequence.
  Godbolt link: https://godbolt.org/z/rEcM88had
* Any other character except the valid escape sequence characters are not allowed
  in escape sequences, so they should not be highlighted as escape sequences. This
  PR introduces `invalid_escape_sequence` so that invalid escape sequences can be
  highlighted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant