Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions expression-src/main/editor/staticresources/monaco/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@
[/(^#.*$)/, 'comment'],

// strings
[/"/, 'string', '@string_double']
[/"/, 'string', '@string_double'],
[/“/, 'string', '@string_curved_left'],
[/”/, 'string', '@string_curved_right']
],

string_double: [
Expand All @@ -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'],
Expand Down Expand Up @@ -202,4 +220,4 @@
}
</script>
</body>
</html>
</html>
7 changes: 6 additions & 1 deletion expression-src/main/src/interpreter/Scanner.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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<Token> scanTokens() {
Expand Down