diff options
| -rw-r--r-- | asm/fibo.atk16 | 6 | ||||
| -rw-r--r-- | atk16-syntax/atk16-syntax-0.0.1.vsix | bin | 4725 -> 4383 bytes | |||
| -rw-r--r-- | atk16-syntax/extension.js | 15 | ||||
| -rw-r--r-- | atk16-syntax/package.json | 19 | ||||
| -rw-r--r-- | atk16-syntax/syntaxes/atk16.tmLanguage.json | 2 | ||||
| -rw-r--r-- | atk16-syntax/themes/atk16-color-theme.json | 41 | ||||
| -rw-r--r-- | src/asm_pass0.py | 4 | ||||
| -rw-r--r-- | src/asm_pass1.py | 3 |
8 files changed, 30 insertions, 60 deletions
diff --git a/asm/fibo.atk16 b/asm/fibo.atk16 index 198ae8b..cae5f5d 100644 --- a/asm/fibo.atk16 +++ b/asm/fibo.atk16 @@ -19,9 +19,9 @@ hlt @label fibo -;? subroutine fibo -;? param RA N -;? return RA Nth fibonacci number +;;; subroutine fibo +;;; param RA N +;;; return RA Nth fibonacci number ; store RB, RC on stack spu RB diff --git a/atk16-syntax/atk16-syntax-0.0.1.vsix b/atk16-syntax/atk16-syntax-0.0.1.vsix Binary files differindex b6aa9dc..342049e 100644 --- a/atk16-syntax/atk16-syntax-0.0.1.vsix +++ b/atk16-syntax/atk16-syntax-0.0.1.vsix diff --git a/atk16-syntax/extension.js b/atk16-syntax/extension.js index e49dd07..2c8e294 100644 --- a/atk16-syntax/extension.js +++ b/atk16-syntax/extension.js @@ -135,21 +135,20 @@ async function findSubroutineInDocument(document, labelText) { for (let i = 0; i < document.lineCount; i++) { const line = document.lineAt(i); if (line.text.includes(`@label ${labelText}`)) { - let labelDefinition = ''; for (let j = i + 1; j < document.lineCount; j++) { const docLine = document.lineAt(j); - const docCommentMatch = docLine.text.match(/;\? (.*)/); + const docCommentMatch = docLine.text.match(/;;;\s+(.*)/); if (docCommentMatch) { const lineText = docCommentMatch[1]; - const parts = lineText.split(/\s/); + const parts = lineText.trim().split(/\s+/g); if (lineText.startsWith('subroutine')) { - name = parts[parts.length - 1]; + name = parts[parts.length - 1].trim(); } else if (lineText.startsWith('param')) { - const [_, reg, ...desc] = parts; - params.push([reg, desc.join(" ")]) + const [_kw, reg, ...desc] = parts; + params.push([reg.trim(), desc.filter(a => a).join(" ")]) } else if (lineText.startsWith('return')) { - const [_, reg, ...desc] = parts; - returns.push([reg, desc.join(" ")]) + const [_kw, reg, ...desc] = parts; + returns.push([reg.trim(), desc.filter(a => a).join(" ")]) } else { extra += `${lineText}\n`; } diff --git a/atk16-syntax/package.json b/atk16-syntax/package.json index bdfbb74..5fd48e6 100644 --- a/atk16-syntax/package.json +++ b/atk16-syntax/package.json @@ -28,12 +28,19 @@ "path": "./syntaxes/atk16.tmLanguage.json" } ], - "themes": [ - { - "label": "ATK16 Color Theme", - "uiTheme": "vs-dark", - "path": "./themes/atk16-color-theme.json" + "configurationDefaults": { + "editor.tokenColorCustomizations": { + "[Default Dark+]": { + "textMateRules": [ + { + "scope": "comment.documentation.atk16", + "settings": { + "fontStyle": "italic" + } + } + ] + } } - ] + } } } diff --git a/atk16-syntax/syntaxes/atk16.tmLanguage.json b/atk16-syntax/syntaxes/atk16.tmLanguage.json index 1faadf9..b12f596 100644 --- a/atk16-syntax/syntaxes/atk16.tmLanguage.json +++ b/atk16-syntax/syntaxes/atk16.tmLanguage.json @@ -4,7 +4,7 @@ "patterns": [ { "name": "comment.documentation.atk16", - "match": ";\\?.*$" + "match": ";;;.*" }, { "name": "comment.line.semicolon.atk16", diff --git a/atk16-syntax/themes/atk16-color-theme.json b/atk16-syntax/themes/atk16-color-theme.json deleted file mode 100644 index d1aebb9..0000000 --- a/atk16-syntax/themes/atk16-color-theme.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "ATK16", - "type": "dark", - "colors": { - "editor.background": "#1E1E1E", - "editor.foreground": "#D4D4D4", - "editor.lineHighlightBackground": "#2D2D30" - }, - "tokenColors": [ - { - "scope": "keyword.control.directive.atk16", - "settings": {} - }, - { - "scope": "variable.parameter.register.atk16", - "settings": {} - }, - { - "scope": "constant.numeric.binary.atk16", - "settings": {} - }, - { - "scope": "keyword.control.instruction.atk16", - "settings": {} - }, - { - "scope": "support.function.atk16", - "settings": {} - }, - { - "scope": "entity.name.label.atk16", - "settings": {} - }, - { - "scope": "comment.documentation.atk16", - "settings": { - "fontStyle": "italic" - } - } - ] -}
\ No newline at end of file diff --git a/src/asm_pass0.py b/src/asm_pass0.py index be6c46a..a0ae56d 100644 --- a/src/asm_pass0.py +++ b/src/asm_pass0.py @@ -1,4 +1,5 @@ from dataclasses import dataclass +import os.path from asm_ops import * from asm_eval import * @@ -26,7 +27,8 @@ def pass_0(lines: list[str], file_name: str) -> Result0: match keyword: case "@include": asm_file_name = args[0] - with open(asm_file_name, "r") as f: + path = os.path.join(os.path.dirname(file_name), asm_file_name + ".atk16") + with open(path, "r") as f: for incl_line in f.readlines(): result_lines.append(Result0Line( src_file=asm_file_name, diff --git a/src/asm_pass1.py b/src/asm_pass1.py index fee72ff..d462526 100644 --- a/src/asm_pass1.py +++ b/src/asm_pass1.py @@ -1,4 +1,6 @@ import importlib +import sys +import os.path from dataclasses import dataclass from asm_ops import * from asm_eval import * @@ -33,6 +35,7 @@ def pass_1(result0: Result0) -> Result1: case "@use": module_name, ops = args[0].split(":") ops_split = ops.split(",") + sys.path.append(os.path.dirname(line.src_file)) module = importlib.import_module(module_name) mod_expansions: OpExpansionDict = module.expansions for op in mod_expansions: |
