From 9c57d47b948427d264fb2743f3a6ef3e0e9b114d Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 4 Sep 2020 17:33:05 +0200 Subject: [PATCH] Fixes https://github.com/microsoft/monaco-editor/issues/1951 --- src/cpp/cpp.test.ts | 30 ++++++++++++++++++++++++++++++ src/cpp/cpp.ts | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/cpp/cpp.test.ts b/src/cpp/cpp.test.ts index d4448c17..fecde6a2 100644 --- a/src/cpp/cpp.test.ts +++ b/src/cpp/cpp.test.ts @@ -828,5 +828,35 @@ testTokenization('cpp', [ { startIndex: 19, type: 'identifier.cpp' } ] } + ], + + // https://github.com/microsoft/monaco-editor/issues/1951 + [ + { + line: 'auto sv = R"({ "message": "Hello World" })""\\n"sv;', + tokens: [ + { startIndex: 0, type: 'keyword.auto.cpp' }, + { startIndex: 4, type: '' }, + { startIndex: 5, type: 'identifier.cpp' }, + { startIndex: 7, type: '' }, + { startIndex: 8, type: 'delimiter.cpp' }, + { startIndex: 9, type: '' }, + { startIndex: 10, type: 'string.raw.begin.cpp' }, + { startIndex: 13, type: 'string.raw.cpp' }, + { startIndex: 41, type: 'string.raw.end.cpp' }, + { startIndex: 43, type: 'string.cpp' }, + { startIndex: 44, type: 'string.escape.cpp' }, + { startIndex: 46, type: 'string.cpp' }, + { startIndex: 47, type: 'identifier.cpp' }, + { startIndex: 49, type: 'delimiter.cpp' } + ] + }, + { + line: ' // This is a comment, not a string', + tokens: [ + { startIndex: 0, type: '' }, + { startIndex: 4, type: 'comment.cpp' } + ] + } ] ]); diff --git a/src/cpp/cpp.ts b/src/cpp/cpp.ts index 4c19cdc2..d002fde6 100644 --- a/src/cpp/cpp.ts +++ b/src/cpp/cpp.ts @@ -377,7 +377,7 @@ export const language = { raw: [ [ - /(.*)(\))(?:([^ ()\\\t]*))(\")/, + /(.*)(\))(?:([^ ()\\\t"]*))(\")/, { cases: { '$3==$S2': [