diff --git a/expression-src/main/editor/staticresources/monaco/main.html b/expression-src/main/editor/staticresources/monaco/main.html index e21f861..190e09f 100644 --- a/expression-src/main/editor/staticresources/monaco/main.html +++ b/expression-src/main/editor/staticresources/monaco/main.html @@ -111,7 +111,9 @@ [/(^#.*$)/, 'comment'], // strings - [/"/, 'string', '@string_double'] + [/"/, 'string', '@string_double'], + [/“/, 'string', '@string_curved_left'], + [/”/, 'string', '@string_curved_right'] ], string_double: [ @@ -122,6 +124,22 @@ [/"/, 'string', '@pop'] ], + string_curved_left: [ + [/\$\{/, { token: 'delimiter.bracket', next: '@bracketCounting' }], + [/[^\\"$]+/, 'string'], + [/@escapes/, 'string.escape'], + [/\\./, 'string.escape.invalid'], + [/“/, 'string', '@pop'] + ], + + string_curved_right: [ + [/\$\{/, { token: 'delimiter.bracket', next: '@bracketCounting' }], + [/[^\\"$]+/, 'string'], + [/@escapes/, 'string.escape'], + [/\\./, 'string.escape.invalid'], + [/”/, 'string', '@pop'] + ], + bracketCounting: [ [/\{/, 'delimiter.bracket', '@bracketCounting'], [/\}/, 'delimiter.bracket', '@pop'], @@ -202,4 +220,4 @@ } - + \ No newline at end of file diff --git a/expression-src/main/src/interpreter/Scanner.cls b/expression-src/main/src/interpreter/Scanner.cls index d38b2b4..f636f78 100644 --- a/expression-src/main/src/interpreter/Scanner.cls +++ b/expression-src/main/src/interpreter/Scanner.cls @@ -22,7 +22,12 @@ public with sharing class Scanner { } public Scanner(String source) { - this.source = source; + this.source = normalizeCurvedQuotes(source); + } + + private String normalizeCurvedQuotes(String input) { + if (input == null) return null; + return input.replace('“', '"').replace('”', '"'); } public List scanTokens() {