aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/AGENTS/ARCH.md4
-rw-r--r--plugin/syntaxes/cie-pseudocode.tmLanguage.json2
-rw-r--r--plugin/test/highlighting.test.js10
3 files changed, 15 insertions, 1 deletions
diff --git a/plugin/AGENTS/ARCH.md b/plugin/AGENTS/ARCH.md
index 8215615..b25a6d7 100644
--- a/plugin/AGENTS/ARCH.md
+++ b/plugin/AGENTS/ARCH.md
@@ -76,6 +76,10 @@ interrupt an interactive program with Ctrl+C before running another file.
Follow the current compiler, rather than implementing every PDF feature:
- Uppercase, case-sensitive keywords; ASCII `<-` assignment; `//` comments.
+- Native C aliases C_INT/C_CHAR/C_STRING/C_DOUBLE and the C_TYPE import keyword
+ use type scopes. C_TYPE's quoted expression remains a string, and casts use
+ ordinary parentheses. `TYPE Name = C_TYPE("...")` is a single-line alias
+ declaration, so it does not open an indentation block.
- Double-quoted strings and single-quoted characters have no escapes or multiline
continuation. The compiler accepts `'''` as a quote character literal.
- Blocks: IF/THEN/ELSE/ENDIF, WHILE/DO/ENDWHILE, REPEAT/UNTIL, FOR/NEXT,
diff --git a/plugin/syntaxes/cie-pseudocode.tmLanguage.json b/plugin/syntaxes/cie-pseudocode.tmLanguage.json
index fe3582c..191eec2 100644
--- a/plugin/syntaxes/cie-pseudocode.tmLanguage.json
+++ b/plugin/syntaxes/cie-pseudocode.tmLanguage.json
@@ -29,7 +29,7 @@
"name": "storage.modifier.cie-pseudocode"
},
{
- "match": "(?<!\\w)(?:INTEGER|REAL|BOOLEAN|STRING|CHAR|ARRAY)(?!\\w)",
+ "match": "(?<!\\w)(?:INTEGER|REAL|BOOLEAN|STRING|CHAR|ARRAY|C_INT|C_CHAR|C_STRING|C_DOUBLE|C_TYPE)(?!\\w)",
"name": "storage.type.cie-pseudocode"
},
{
diff --git a/plugin/test/highlighting.test.js b/plugin/test/highlighting.test.js
index 0f677a3..f7a67db 100644
--- a/plugin/test/highlighting.test.js
+++ b/plugin/test/highlighting.test.js
@@ -33,6 +33,11 @@ test('C++ style scopes distinguish keywords, types, literals, operators and buil
['IF Ready THEN', 'IF', 'keyword.control'],
['DECLARE X : INTEGER', 'DECLARE', 'storage.modifier'],
['DECLARE X : INTEGER', 'INTEGER', 'storage.type'],
+ ['DECLARE X : C_INT', 'C_INT', 'storage.type'],
+ ['DECLARE X : C_CHAR', 'C_CHAR', 'storage.type'],
+ ['DECLARE X : C_STRING', 'C_STRING', 'storage.type'],
+ ['OUTPUT (C_DOUBLE)X', 'C_DOUBLE', 'storage.type'],
+ ['TYPE Native = C_TYPE("int")', 'C_TYPE', 'storage.type'],
['X <- TRUE', 'TRUE', 'constant.language'],
['X <- 12.5', '12.5', 'constant.numeric'],
['X <- 2 DIV 1', 'DIV', 'keyword.operator.word'],
@@ -72,6 +77,11 @@ test('exception keywords reuse C++ scopes and ignore non-keyword occurrences', (
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.')));
+ assert.ok(scopesAt('TYPE Native = C_TYPE("C_INT")', 'C_INT').some(s => s.startsWith('string.')));
+ assert.ok(scopesAt('// C_TYPE("int")', 'C_TYPE').some(s => s.startsWith('comment.')));
+ for (const text of ['c_int', 'C_INTValue', 'MyC_INT', 'C_TYPE_1']) {
+ assert.ok(!scopesAt(text, text).some(s => s.startsWith('storage.')), text);
+ }
for (const text of ['if X then', 'IFValue <- 1', 'CASE OF X', 'CLASS Example']) {
assert.ok(!scopesAt(text, text.split(' ')[0]).some(
s => /^(keyword|storage)\./.test(s)), text);