From 075be30f2c28fce029e73d9b05b617487be0b9f4 Mon Sep 17 00:00:00 2001 From: nreed Date: Wed, 14 Jul 2021 12:38:06 -0400 Subject: [PATCH 1/9] 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' }], From 5fa50ecc210ae9a93e7232ab507c5d12413c404e Mon Sep 17 00:00:00 2001 From: nreed Date: Wed, 14 Jul 2021 12:53:29 -0400 Subject: [PATCH 2/9] fix rust char literal highlighting #2481 --- src/rust/rust.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rust/rust.ts b/src/rust/rust.ts index 9640c627..ea55d6e0 100644 --- a/src/rust/rust.ts +++ b/src/rust/rust.ts @@ -290,7 +290,7 @@ export const language = { // Lifetime annotations [/'[a-zA-Z_][a-zA-Z0-9_]*(?=[^\'])/, 'identifier'], // Byte literal - [/'\S'/, 'string.byteliteral'], + [/'(\S|@escapes)'/, 'string.byteliteral'], // Strings [/"/, { token: 'string.quote', bracket: '@open', next: '@string' }], { include: '@numbers' }, From 37653132494466312c1b85e056b7a9a4322593d3 Mon Sep 17 00:00:00 2001 From: nreed Date: Wed, 14 Jul 2021 14:52:09 -0400 Subject: [PATCH 3/9] Added raw string tests --- src/rust/rust.test.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/rust/rust.test.ts b/src/rust/rust.test.ts index 51be2a86..d1015ea8 100644 --- a/src/rust/rust.test.ts +++ b/src/rust/rust.test.ts @@ -23,6 +23,44 @@ testTokenization('rust', [ ] } ], + // Raw String + [ + { + line: 'r"This is a raw string" ', + tokens: [ + { startIndex: 0, type: 'string.raw.rust' }, + { startIndex: 23, type: 'white.rust' }, + ] + } + ], + [ + { + line: 'r#"This is a raw string"# ', + tokens: [ + { startIndex: 0, type: 'string.raw.rust' }, + { startIndex: 25, type: 'white.rust' }, + ] + } + ], + [ + { + line: 'r##"This is a# raw string"## ', + tokens: [ + { startIndex: 0, type: 'string.raw.rust' }, + { startIndex: 28, type: 'white.rust' }, + ] + } + ], + [ + { + line: 'r###"This is ##"#"##a raw### string"### ', + tokens: [ + { startIndex: 0, type: 'string.raw.rust' }, + { startIndex: 39, type: 'white.rust' }, + ] + } + ], + // Byte literal [ { From 8c28f5c36700c560c505658679698821618e21a7 Mon Sep 17 00:00:00 2001 From: nreed Date: Wed, 14 Jul 2021 14:59:13 -0400 Subject: [PATCH 4/9] removed overlap with other branch --- src/rust/rust.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rust/rust.ts b/src/rust/rust.ts index ea55d6e0..90adf3b7 100644 --- a/src/rust/rust.ts +++ b/src/rust/rust.ts @@ -290,7 +290,7 @@ export const language = { // Lifetime annotations [/'[a-zA-Z_][a-zA-Z0-9_]*(?=[^\'])/, 'identifier'], // Byte literal - [/'(\S|@escapes)'/, 'string.byteliteral'], + [/'(\S)'/, 'string.byteliteral'], // Strings [/"/, { token: 'string.quote', bracket: '@open', next: '@string' }], { include: '@numbers' }, From 26a8cec43ac420219d3b139399447fb51a76b911 Mon Sep 17 00:00:00 2001 From: nreed Date: Wed, 14 Jul 2021 15:01:26 -0400 Subject: [PATCH 5/9] removed overlap with other branch --- src/rust/rust.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rust/rust.ts b/src/rust/rust.ts index 90adf3b7..9640c627 100644 --- a/src/rust/rust.ts +++ b/src/rust/rust.ts @@ -290,7 +290,7 @@ export const language = { // Lifetime annotations [/'[a-zA-Z_][a-zA-Z0-9_]*(?=[^\'])/, 'identifier'], // Byte literal - [/'(\S)'/, 'string.byteliteral'], + [/'\S'/, 'string.byteliteral'], // Strings [/"/, { token: 'string.quote', bracket: '@open', next: '@string' }], { include: '@numbers' }, From 65554d83e3d44a62d95e3456975856b4f324e4c7 Mon Sep 17 00:00:00 2001 From: nreed Date: Wed, 14 Jul 2021 17:13:57 -0400 Subject: [PATCH 6/9] fix r roxygen comment highlighting #2086 --- src/r/r.test.ts | 15 +++++++++++++++ src/r/r.ts | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/r/r.test.ts b/src/r/r.test.ts index e7396278..c5a76cda 100644 --- a/src/r/r.test.ts +++ b/src/r/r.test.ts @@ -101,6 +101,21 @@ testTokenization('r', [ ] } ], + [ + { + line: " #'", + tokens: [ + { startIndex: 0, type: 'white.r' }, + { startIndex: 1, type: 'comment.doc.r' } + ] + }, + { + line: " ", + tokens: [ + { startIndex: 0, type: 'white.r' }, + ] + } + ], // Strings [ diff --git a/src/r/r.ts b/src/r/r.ts index 388a46f7..cb5fbdf7 100644 --- a/src/r/r.ts +++ b/src/r/r.ts @@ -163,7 +163,7 @@ export const language = { [/[{}\[\]()]/, '@brackets'], { include: '@operators' }, - + [/#'$/, 'comment.doc'], [/#'/, 'comment.doc', '@roxygen'], [/(^#.*$)/, 'comment'], @@ -186,6 +186,7 @@ export const language = { // Recognize Roxygen comments roxygen: [ + [/(^$)/, { token: 'comment.doc', next: '@pop' }], [ /@\w+/, { From e50e2a274b357bb920c44e9b9b3890d2b9b432be Mon Sep 17 00:00:00 2001 From: nreed Date: Wed, 14 Jul 2021 17:16:49 -0400 Subject: [PATCH 7/9] fix r roxygen comment highlighting #2086 --- src/rust/rust.test.ts | 38 -------------------------------------- src/rust/rust.ts | 3 --- 2 files changed, 41 deletions(-) diff --git a/src/rust/rust.test.ts b/src/rust/rust.test.ts index d1015ea8..51be2a86 100644 --- a/src/rust/rust.test.ts +++ b/src/rust/rust.test.ts @@ -23,44 +23,6 @@ testTokenization('rust', [ ] } ], - // Raw String - [ - { - line: 'r"This is a raw string" ', - tokens: [ - { startIndex: 0, type: 'string.raw.rust' }, - { startIndex: 23, type: 'white.rust' }, - ] - } - ], - [ - { - line: 'r#"This is a raw string"# ', - tokens: [ - { startIndex: 0, type: 'string.raw.rust' }, - { startIndex: 25, type: 'white.rust' }, - ] - } - ], - [ - { - line: 'r##"This is a# raw string"## ', - tokens: [ - { startIndex: 0, type: 'string.raw.rust' }, - { startIndex: 28, type: 'white.rust' }, - ] - } - ], - [ - { - line: 'r###"This is ##"#"##a raw### string"### ', - tokens: [ - { startIndex: 0, type: 'string.raw.rust' }, - { startIndex: 39, type: 'white.rust' }, - ] - } - ], - // Byte literal [ { diff --git a/src/rust/rust.ts b/src/rust/rust.ts index 9640c627..428583c8 100644 --- a/src/rust/rust.ts +++ b/src/rust/rust.ts @@ -270,9 +270,6 @@ 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_]+/, { cases: { From c2d74bbc1d7cc28497ad45aee61691ca222cc453 Mon Sep 17 00:00:00 2001 From: nreed Date: Wed, 14 Jul 2021 17:17:55 -0400 Subject: [PATCH 8/9] fix r roxygen comment highlighting #2086 --- src/rust/rust.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/rust/rust.ts b/src/rust/rust.ts index 428583c8..c9f45f3d 100644 --- a/src/rust/rust.ts +++ b/src/rust/rust.ts @@ -270,6 +270,7 @@ export const language = { tokenizer: { root: [ + [ /[a-zA-Z][a-zA-Z0-9_]*!?|_[a-zA-Z0-9_]+/, { cases: { @@ -326,10 +327,6 @@ 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' }], From 6bc4008730289432886150e60680ed9c6b2b6113 Mon Sep 17 00:00:00 2001 From: nreed Date: Wed, 14 Jul 2021 17:22:19 -0400 Subject: [PATCH 9/9] fix r roxygen comment highlighting #2086 --- src/r/r.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/r/r.ts b/src/r/r.ts index cb5fbdf7..8ea23731 100644 --- a/src/r/r.ts +++ b/src/r/r.ts @@ -186,7 +186,6 @@ export const language = { // Recognize Roxygen comments roxygen: [ - [/(^$)/, { token: 'comment.doc', next: '@pop' }], [ /@\w+/, {