From fed12356ba4cd7c36b10fe5191878c7348d27206 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Wed, 14 Oct 2026 03:40:32 +0000 Subject: feat(plugin): highlight native C types and imports Co-Authored-By: Claude Fable 5.1 --- plugin/AGENTS/ARCH.md | 4 ++++ plugin/syntaxes/cie-pseudocode.tmLanguage.json | 2 +- plugin/test/highlighting.test.js | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'plugin') 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": "(? { 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); -- cgit v1.3.1-4-g156e