aboutsummaryrefslogtreecommitdiff
path: root/pu2/i2-syntax/syntaxes
diff options
context:
space:
mode:
Diffstat (limited to 'pu2/i2-syntax/syntaxes')
-rw-r--r--pu2/i2-syntax/syntaxes/i2.tmLanguage.json106
1 files changed, 106 insertions, 0 deletions
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