aboutsummaryrefslogtreecommitdiff
path: root/pu2/i2-syntax/syntaxes/i2.tmLanguage.json
blob: d740a7d837cfd8440c5353431b2e6b258a7ae0fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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": ","
        }
      ]
    }
  }
}