From 075be30f2c28fce029e73d9b05b617487be0b9f4 Mon Sep 17 00:00:00 2001 From: nreed Date: Wed, 14 Jul 2021 12:38:06 -0400 Subject: [PATCH] fix rust raw string highlighting #2552 --- src/rust/rust.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/rust/rust.ts b/src/rust/rust.ts index c9f45f3d..9640c627 100644 --- a/src/rust/rust.ts +++ b/src/rust/rust.ts @@ -270,6 +270,8 @@ export const language = { tokenizer: { root: [ + // Raw string literals + [/r(?=#*")/, { token: 'string.raw', bracket: '@open', next: '@stringraw' }], [ /[a-zA-Z][a-zA-Z0-9_]*!?|_[a-zA-Z0-9_]+/, { @@ -327,6 +329,10 @@ export const language = { [/\\./, 'string.escape.invalid'], [/"/, { token: 'string.quote', bracket: '@close', next: '@pop' }] ], + stringraw: [ + [/[^#"]/, 'string.raw'], + [/(#*)".*?"\1/, { token: 'string.raw', bracket: '@close', next: '@pop' }] + ], numbers: [ //Octal [/(0o[0-7_]+)(@intSuffixes)?/, { token: 'number' }],