From 96abb73ace9bd9b97ac8c9b6f61653a1442bec4e Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Thu, 31 Oct 2024 19:16:35 -0400 Subject: [PATCH 1/2] fix(rust) emoji supported in single quote strings --- src/languages/rust.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/languages/rust.js b/src/languages/rust.js index d0e36fa6bf..7c88d6045b 100644 --- a/src/languages/rust.js +++ b/src/languages/rust.js @@ -199,10 +199,19 @@ export default function(hljs) { illegal: null }), { - className: 'string', + scope: 'string', variants: [ { begin: /b?r(#*)"(.|\n)*?"\1(?!#)/ }, - { begin: /b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/ } + { + begin: /b?'/, + end: /'/, + contains: [ + { + scope: "char.escape", + match: /\\(\w|x\w{2}|u\w{4}|U\w{8})/ + } + ] + } ] }, { From e8a26b4e534a274ae4d5197e3791b1c5cfa46f2a Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Sat, 14 Dec 2024 10:15:40 -0500 Subject: [PATCH 2/2] fix markup tests --- CHANGES.md | 1 + test/markup/rust/strings.expect.txt | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 329d2c0e2c..c6f5b2aede 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ CAVEATS / POTENTIALLY BREAKING CHANGES Core Grammars: +- fix(rust) - adds emoji support in single quote strings [joshgoebel][] - fix(makefile) - allow strings inside `$()` expressions [aneesh98][] - enh(css) add all properties listed on MDN (96 additions including `anchor-name`, `aspect-ratio`, `backdrop-filter`, `container`, `margin-trim`, `place-content`, `scroll-timeline`, ...) [BaliBalo][] - enh(erlang) OTP 27 triple-quoted strings [nixxquality][] diff --git a/test/markup/rust/strings.expect.txt b/test/markup/rust/strings.expect.txt index 030300a5c0..ceff4aeff9 100644 --- a/test/markup/rust/strings.expect.txt +++ b/test/markup/rust/strings.expect.txt @@ -1,8 +1,8 @@ 'a'; -'\n'; -'\x1A'; -'\u12AS'; -'\U1234ASDF'; +'\n'; +'\x1A'; +'\u12AS'; +'\U1234ASDF'; b'a'; "hello";