Skip to content

fix(rust): correctly highlight escaped backslash char literals#4384

Open
bitreonx wants to merge 3 commits intohighlightjs:mainfrom
bitreonx:fix/rust-backslash-char-literal
Open

fix(rust): correctly highlight escaped backslash char literals#4384
bitreonx wants to merge 3 commits intohighlightjs:mainfrom
bitreonx:fix/rust-backslash-char-literal

Conversation

@bitreonx
Copy link

Changes

Fixed the Rust language grammar to correctly highlight escaped backslash character literals like '\\'.

The previous regex pattern didn't properly handle the escaped backslash case, causing the closing quote to be left unmatched and breaking character literal parsing.

Updated the character escape pattern to correctly match Rust's escape sequences:

  • Basic escapes: \\, \', \n, \r, \t, \0
  • Hex escapes: \xHH (2 hex digits)
  • Unicode escapes: \u{HHHHHH} (1-6 hex digits in braces)

Checklist

  • Added markup tests
  • Updated the changelog at CHANGES.md

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