messing around.

This commit is contained in:
ed
2026-08-14 22:43:27 -04:00
parent 7ec778a68e
commit d23b6a2a36
8 changed files with 35 additions and 23 deletions
Binary file not shown.
@@ -4,7 +4,7 @@
"semanticHighlighting": true,
"colors": {
"editor.background": "#121212",
"editor.foreground": "#D25A6EFF",
"editor.foreground": "#c6b2a3",
"editor.lineHighlightBackground": "#1c1c1c",
"editor.selectionBackground": "#164371",
"editor.selectionForeground": "#c8c8c8",
@@ -15,12 +15,12 @@
"editorRuler.foreground": "#505050",
"editorGutter.background": "#121212",
"editorBracketMatch.background": "#3b514d",
"editor.foldBackground": "#0c0c0c",
"editor.wordHighlightBackground": "#121212",
"editor.foldBackground": "#0c0c0c81",
"editor.wordHighlightBackground": "#1212124d",
"editor.wordHighlightStrongBackground": "#303030",
"editorCursor.foreground": "#00fff4",
"editorWhitespace.foreground": "#181818",
"editorLineHighlightBorder": "#1c1c1c",
// "editorLineHighlightBorder": "#1c1c1c",
"editorWidget.background": "#121212",
"editorSuggestWidget.background": "#2c334b",
"editorHoverWidget.background": "#2c334b"
@@ -30,7 +30,7 @@
"keyword": { "foreground": "#d8bd5b" },
"string": { "foreground": "#d46a54" },
"number": { "foreground": "#b5cea8" },
"operator": { "foreground": "#00ffff" },
"operator": { "foreground": "#54cfcf" },
"class": { "foreground": "#54a4d6" },
"struct": { "foreground": "#54a4d6" },
"enum": { "foreground": "#54a4d6" },
@@ -39,7 +39,7 @@
"function": { "foreground": "#cccab5" },
"method": { "foreground": "#6090a9" },
"variable": { "foreground": "#bc966c" },
"parameter": { "foreground": "#867660", "fontStyle": "underline" },
"parameter": { "foreground": "#867660" },
"property": { "foreground": "#acb8c8" },
"*.static": { "foreground": "#9e95c6" },
"macro": { "foreground": "#5ea852" },
@@ -54,7 +54,7 @@
"tapeAnnotation": { "foreground": "#d8bd5b" },
"tapeBindType": { "foreground": "#54a4d6" },
"tapePhase": { "foreground": "#b8d7a3", "fontStyle": "italic" },
"tapeLabel": { "foreground": "#c8c8c8", "fontStyle": "bold" },
"tapeLabel": { "foreground": "#959595", "fontStyle": "bold" },
"tapeCpuInstruction": { "foreground": "#6090a9" },
"tapeGteInstruction": { "foreground": "#9e95c6" },
"tapeGpuInstruction": { "foreground": "#bf7dac" },
@@ -67,8 +67,8 @@
"tapeGprRegister.tapeWrite": { "foreground": "#d68a36", "fontStyle": "bold" },
"tapeCop2Register.tapeRead": { "foreground": "#a373b0", "fontStyle": "italic" },
"tapeCop2Register.tapeWrite": { "foreground": "#d46a54", "fontStyle": "bold" },
"*.tapeAuto": { "fontStyle": "underline" },
"tapeControlFlow": { "foreground": "#76ff7d", "fontStyle": "bold" },
// "*.tapeAuto": { },
"tapeControlFlow": { "foreground": "#63d169", "fontStyle": "bold" },
"tapeDelaySlot": { "foreground": "#ff5647" }
},
"tokenColors": [
Binary file not shown.
+10
View File
@@ -22,6 +22,7 @@ const TOKEN_TYPES = [
"tapeCop2Register",
"tapeDuffleType",
"tapeAttribute",
"keyword",
];
const TOKEN_MODIFIERS = ["declaration", "tapeRead", "tapeWrite", "tapeAuto"];
@@ -36,6 +37,14 @@ const ANNOTATIONS = new Set([
"atom_auto_reg", "phase_auto_reg", "atom_dbg_skip",
]);
const DSL_KEYWORDS = new Set([
"FI_", "I_", "NI_", "Relative_", "Struct_", "Enum_", "Union_",
"TypeR_", "TypeV_", "align_", "internal", "local_persist", "global",
"O_", "S_", "C_", "T_", "tmpl", "glue", "r_", "v_", "tr_", "tv_",
"rgcc", "rlit", "r_use", "r_set", "r_mod", "r_imm", "r_mem",
"enc_op", "enc_rs", "enc_rt", "enc_rd", "enc_imm", "enc_i", "enc_r",
]);
const DELAY_SLOT_KEYWORDS = new Set(["LdSlot_", "BdSlot_"]);
const CONTROL_FLOW_PREFIXES = /^(?:branch_|jump_|call_)/;
@@ -151,6 +160,7 @@ function classifyDocument(source, filePath, workspaceIndex, shouldCancel = () =>
if (!type && index.bindTypes.has(token.text)) type = "tapeBindType";
if (!type && index.types.has(token.text)) type = "tapeDuffleType";
if (!type && DSL_KEYWORDS.has(token.text)) type = "keyword";
if (!type && index.attributes.has(token.text)) type = "tapeAttribute";
if (!type) type = registerType(token.text, index);
if (!type && DELAY_SLOT_KEYWORDS.has(token.text)) type = "tapeDelaySlot";
+9 -7
View File
@@ -1,9 +1,9 @@
{
"name": "tape-atom-syntax",
"displayName": "Tape Atom DSL",
"description": "Source-derived semantic highlighting for the Tape/Atom MIPS macro DSL",
"name": "atomasm-psx",
"displayName": "AtomAsm-PSX",
"description": "Semantic highlighting for the PS1 Tape/Atom MIPS macro DSL",
"publisher": "local",
"version": "0.2.0",
"version": "0.3.0",
"engines": { "vscode": "^1.80.0" },
"categories": ["Programming Languages"],
"activationEvents": ["onLanguage:c", "onLanguage:cpp"],
@@ -17,7 +17,7 @@
],
"scripts": {
"test": "node --test test/*.test.js",
"package": "npx --yes @vscode/vsce@3.6.1 package --allow-missing-repository --skip-license --out tape-atom-syntax-0.2.0.vsix"
"package": "npx --yes @vscode/vsce@3.6.1 package --allow-missing-repository --skip-license --out atomasm-psx-0.3.0.vsix"
},
"contributes": {
"semanticTokenTypes": [
@@ -38,7 +38,8 @@
{ "id": "tapeGprRegister", "superType": "variable", "description": "MIPS GPR alias" },
{ "id": "tapeCop2Register", "superType": "variable", "description": "COP2 data or control register alias" },
{ "id": "tapeDuffleType", "superType": "type", "description": "Duffle type or type constructor" },
{ "id": "tapeAttribute", "superType": "keyword", "description": "Duffle linkage or storage attribute" }
{ "id": "tapeAttribute", "superType": "keyword", "description": "Duffle linkage or storage attribute" },
{ "id": "keyword", "description": "Standard keyword (DSL built-in macros)" }
],
"semanticTokenModifiers": [
{ "id": "tapeRead", "description": "Register declared in atom_reads" },
@@ -66,7 +67,8 @@
"tapeGprRegister": ["variable.other.constant.duffle.gpr"],
"tapeCop2Register": ["variable.other.constant.duffle.cop2"],
"tapeDuffleType": ["storage.type.duffle.type"],
"tapeAttribute": ["storage.modifier.duffle.attr"]
"tapeAttribute": ["storage.modifier.duffle.attr"],
"keyword": ["keyword"]
}
}
],
+3
View File
@@ -11,6 +11,9 @@ const BASE_TYPES = [
const BASE_ATTRIBUTES = [
"FI_", "I_", "NI_", "Relative_", "Struct_", "Enum_", "Union_",
"TypeR_", "TypeV_", "align_", "internal", "local_persist", "global",
"O_", "S_", "C_", "T_", "tmpl", "glue", "r_", "v_", "tr_", "tv_",
"rgcc", "rlit", "r_use", "r_set", "r_mod", "r_imm", "r_mem",
"enc_op", "enc_rs", "enc_rt", "enc_rd", "enc_imm", "enc_i", "enc_r",
];
function createIndex() {
@@ -64,8 +64,8 @@
"name": "storage.type.duffle.type"
},
"attributes": {
"match": "\\b(?:FI_|I_|NI_|Relative_|align_|internal|local_persist|global)\\b",
"name": "storage.modifier.duffle.attr"
"match": "\\b(?:FI_|I_|NI_|Relative_|align_|internal|local_persist|global|O_|S_|C_|T_|tmpl|glue|r_|v_|tr_|tv_|rgcc|rlit|r_use|r_set|r_mod|r_imm|r_mem|enc_op|enc_rs|enc_rt|enc_rd|enc_imm|enc_i|enc_r)\\b",
"name": "keyword"
}
}
}
+2 -5
View File
@@ -31,7 +31,7 @@ test("package semantic legend matches classifier exports", () => {
const contributedTypes = packageJson.contributes.semanticTokenTypes.map((entry) => entry.id);
const contributedModifiers = packageJson.contributes.semanticTokenModifiers.map((entry) => entry.id);
assert.equal(packageJson.version, "0.2.0");
assert.equal(packageJson.version, "0.3.0");
assert.deepEqual(contributedTypes, TOKEN_TYPES);
assert.deepEqual(contributedModifiers, TOKEN_MODIFIERS.filter((name) => name !== "declaration"));
});
@@ -59,7 +59,7 @@ test("every semantic token has a scope mapping; DSL-specific tokens also have gr
const grammarRequired = new Set([
"tapeAtomKeyword", "tapeAtomName", "tapeComponentKeyword", "tapeComponentName",
"tapeAnnotation", "tapeBindType", "tapePhase", "tapeLabel",
"tapeDelaySlot", "tapeDuffleType", "tapeAttribute",
"tapeDelaySlot", "tapeDuffleType", "keyword",
]);
for (const tokenType of TOKEN_TYPES) {
@@ -84,8 +84,5 @@ test("TextMate offset labels stay scoped to atom_offset calls", () => {
test("workspace enables semantic highlighting", () => {
const settings = readJson(path.resolve(ROOT, "..", "settings.json"));
assert.equal(settings["editor.semanticHighlighting.enabled"], true);
const semantic = settings["editor.semanticTokenColorCustomizations"];
assert.equal(semantic.enabled, true);
});