diff options
Diffstat (limited to 'pu2/i2-syntax')
| -rw-r--r-- | pu2/i2-syntax/language-configuration.json | 30 | ||||
| -rw-r--r-- | pu2/i2-syntax/package.json | 35 | ||||
| -rw-r--r-- | pu2/i2-syntax/syntaxes/i2.tmLanguage.json | 106 |
3 files changed, 171 insertions, 0 deletions
diff --git a/pu2/i2-syntax/language-configuration.json b/pu2/i2-syntax/language-configuration.json new file mode 100644 index 0000000..2cbf13c --- /dev/null +++ b/pu2/i2-syntax/language-configuration.json @@ -0,0 +1,30 @@ +{ + "comments": { + "lineComment": "//" + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + "autoClosingPairs": [ + { "open": "{", "close": "}" }, + { "open": "[", "close": "]" }, + { "open": "(", "close": ")" }, + { "open": "\"", "close": "\"", "notIn": ["string"] }, + { "open": "'", "close": "'", "notIn": ["string"] } + ], + "surroundingPairs": [ + { "open": "{", "close": "}" }, + { "open": "[", "close": "]" }, + { "open": "(", "close": ")" }, + { "open": "\"", "close": "\"" }, + { "open": "'", "close": "'" } + ], + "folding": { + "markers": { + "start": "^\\s*\\{", + "end": "^\\s*\\}" + } + } +} diff --git a/pu2/i2-syntax/package.json b/pu2/i2-syntax/package.json new file mode 100644 index 0000000..1810074 --- /dev/null +++ b/pu2/i2-syntax/package.json @@ -0,0 +1,35 @@ +{ + "name": "i2-asm-syntax", + "displayName": "I2 Assembly (i2)", + "version": "0.0.1", + "publisher": "moonflower", + "engines": { + "vscode": "^1.50.0" + }, + "categories": [ + "Programming Languages" + ], + "contributes": { + "languages": [ + { + "id": "i2", + "aliases": ["i2", "I2", "i2-asm"], + "extensions": [".i2"], + "configuration": "./language-configuration.json" + } + ], + "grammars": [ + { + "language": "i2", + "scopeName": "source.i2", + "path": "./syntaxes/i2.tmLanguage.json" + } + ], + "tokenColors": [ + { + "scope": "constant.other.macro-reference.i2", + "settings": { "foreground": "#FF8C00" } + } + ] + } +} diff --git a/pu2/i2-syntax/syntaxes/i2.tmLanguage.json b/pu2/i2-syntax/syntaxes/i2.tmLanguage.json new file mode 100644 index 0000000..d740a7d --- /dev/null +++ b/pu2/i2-syntax/syntaxes/i2.tmLanguage.json @@ -0,0 +1,106 @@ +{ + "scopeName": "source.i2", + "name": "I2 IR / Macro language", + "fileTypes": ["i2"], + "patterns": [ + { "include": "#comments" }, + { "include": "#macro-reference" }, + { "include": "#braces" }, + { "include": "#brackets" }, + { "include": "#semicolon" }, + { "include": "#keywords" }, + { "include": "#function-call" }, + { "include": "#memory-index" }, + { "include": "#variables" }, + { "include": "#hex" }, + { "include": "#decimal" }, + { "include": "#char" }, + { "include": "#blob" }, + { + "begin": "\\b(macro)\\b\\s+([A-Za-z_][A-Za-z0-9_]*)\\s*(?=\\()", + "beginCaptures": { + "1": { "name": "keyword.control.macro.i2" }, + "2": { "name": "entity.name.function.macro.i2" } + }, + "end": "\\}", + "name": "meta.macro.definition.i2", + "patterns": [ + { "include": "#comments" }, + { "include": "#macro-reference" }, + { "include": "#braces" }, + { "include": "#semicolon" }, + { "include": "#keywords" }, + { "include": "#function-call" }, + { "include": "#memory-index" }, + { "include": "#variables" }, + { "include": "#hex" }, + { "include": "#decimal" }, + { "include": "#char" }, + { "include": "#blob" } + ] + } + ], + "repository": { + "comments": { + "name": "comment.line.double-slash.i2", + "match": "//.*$" + }, + "braces": { + "name": "punctuation.section.block.i2", + "match": "[\\{\\}]" + }, + "brackets": { + "name": "punctuation.brackets.square.i2", + "match": "[\\[\\]]" + }, + "semicolon": { + "name": "punctuation.separator.semicolon.i2", + "match": ";" + }, + "keywords": { + "name": "keyword.control.i2", + "match": "\\b(?:macro|system|exit)\\b" + }, + "function-call": { + "name": "entity.name.function.i2", + "match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\s*(?=\\()" + }, + "variables": { + "name": "variable.other.i2", + "match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b" + }, + "memory-index": { + "name": "variable.parameter.memory-index.i2", + "match": "@\\s*\\d+" + }, + "macro-reference": { + "name": "constant.other.macro-reference.i2", + "match": "/[^/\\r\\n]+/" + }, + "hex": { + "name": "constant.numeric.hex.i2", + "match": "\\b0x[0-9A-Fa-f]+\\b" + }, + "decimal": { + "name": "constant.numeric.decimal.i2", + "match": "\\b\\d+\\b" + }, + "char": { + "name": "string.quoted.single.char.i2", + "match": "'(\\\\.|[^'\\\\])'" + }, + "blob": { + "begin": "\\[", + "end": "\\]", + "name": "meta.bracket.blob.i2", + "patterns": [ + { "include": "#char" }, + { "include": "#decimal" }, + { + "name": "punctuation.separator.comma.i2", + "match": "," + } + ] + } + } +}
\ No newline at end of file |
