aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/syntaxes/cie-pseudocode.tmLanguage.json6
-rw-r--r--plugin/test/highlighting.test.js9
2 files changed, 13 insertions, 2 deletions
diff --git a/plugin/syntaxes/cie-pseudocode.tmLanguage.json b/plugin/syntaxes/cie-pseudocode.tmLanguage.json
index cb7d401..cf1957f 100644
--- a/plugin/syntaxes/cie-pseudocode.tmLanguage.json
+++ b/plugin/syntaxes/cie-pseudocode.tmLanguage.json
@@ -37,7 +37,11 @@
"name": "keyword.operator.word.cie-pseudocode"
},
{
- "match": "<-|<>|<=|>=|[+*/=&^<>-]",
+ "match": "<-",
+ "name": "keyword.operator.assignment.cpp"
+ },
+ {
+ "match": "<>|<=|>=|[+*/=&^<>-]",
"name": "keyword.operator.cie-pseudocode"
},
{
diff --git a/plugin/test/highlighting.test.js b/plugin/test/highlighting.test.js
index 89e031a..24751bf 100644
--- a/plugin/test/highlighting.test.js
+++ b/plugin/test/highlighting.test.js
@@ -36,7 +36,7 @@ test('C++ style scopes distinguish keywords, types, literals, operators and buil
['X <- TRUE', 'TRUE', 'constant.language'],
['X <- 12.5', '12.5', 'constant.numeric'],
['X <- 2 DIV 1', 'DIV', 'keyword.operator.word'],
- ['X <- 1', '<-', 'keyword.operator'],
+ ['X <- 1', '<-', 'keyword.operator.assignment.cpp'],
['OUTPUT "text"', 'text', 'string.quoted.double'],
["X <- 'A'", 'A', 'string.quoted.single']
]) assert.ok(scopesAt(text, word).some(s => s.startsWith(scope)), text);
@@ -46,6 +46,13 @@ test('C++ style scopes distinguish keywords, types, literals, operators and buil
}
});
+test('both assignment characters share the C++ assignment scope', () => {
+ const text = 'X <- 1';
+ assert.deepEqual(scopesAt(text, '<-'), scopesAt(text, '-'));
+ assert.ok(!scopesAt('X < 1', '<').includes('keyword.operator.assignment.cpp'));
+ assert.ok(!scopesAt('X - 1', '-').includes('keyword.operator.assignment.cpp'));
+});
+
test('comments, strings, lowercase and keyword prefixes cannot become keywords', () => {
assert.ok(scopesAt('// IF [(', 'IF').some(s => s.startsWith('comment.')));
assert.ok(scopesAt('OUTPUT "IF // ["', 'IF').some(s => s.startsWith('string.')));