aboutsummaryrefslogtreecommitdiff
path: root/editors/vscode/syntaxes/zc.tmLanguage.json
blob: 6f76e03500ab96369cdfc2899127527add387f5a (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
{
  "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
  "name": "ZC",
  "scopeName": "source.zc",
  "patterns": [
    { "include": "#comments" },
    { "include": "#strings" },
    { "include": "#numbers" },
    { "include": "#ownership" },
    { "include": "#keywords" },
    { "include": "#types" },
    { "include": "#builtins" },
    { "include": "#constants" },
    { "include": "#function-declarations" },
    { "include": "#function-calls" },
    { "include": "#operators" }
  ],
  "repository": {
    "comments": {
      "patterns": [
        {
          "name": "comment.line.double-slash.zc",
          "match": "//.*$"
        },
        {
          "name": "comment.block.zc",
          "begin": "/\\*",
          "end": "\\*/"
        }
      ]
    },
    "strings": {
      "patterns": [
        {
          "name": "string.quoted.double.byte.zc",
          "begin": "b\"",
          "end": "\"",
          "patterns": [{ "name": "constant.character.escape.zc", "match": "\\\\." }]
        },
        {
          "name": "string.quoted.double.zc",
          "begin": "\"",
          "end": "\"",
          "patterns": [{ "name": "constant.character.escape.zc", "match": "\\\\." }]
        },
        {
          "name": "string.quoted.single.zc",
          "begin": "'",
          "end": "'",
          "patterns": [{ "name": "constant.character.escape.zc", "match": "\\\\." }]
        }
      ]
    },
    "numbers": {
      "patterns": [
        {
          "name": "constant.numeric.hex.zc",
          "match": "\\b0[xX][0-9a-fA-F]+\\b"
        },
        {
          "name": "constant.numeric.float.zc",
          "match": "\\b[0-9]+\\.[0-9]+([eE][+-]?[0-9]+)?\\b|\\b[0-9]+[eE][+-]?[0-9]+\\b"
        },
        {
          "name": "constant.numeric.decimal.zc",
          "match": "\\b[0-9]+\\b"
        }
      ]
    },
    "ownership": {
      "patterns": [
        {
          "name": "storage.modifier.lifetime.tag.zc",
          "match": "\\.(u|m|d)\\b"
        },
        {
          "name": "keyword.operator.lifetime.recast.zc",
          "match": "\\b(u|m|d)\\*(?=[a-zA-Z_])"
        }
      ]
    },
    "keywords": {
      "patterns": [
        {
          "name": "keyword.control.zc",
          "match": "\\b(if|else|while|do|for|switch|case|default|break|continue|return)\\b"
        },
        {
          "name": "keyword.declaration.zc",
          "match": "\\b(fn|let|struct|type|typedef|enum|const|enhance|micro|vm)\\b"
        },
        {
          "name": "keyword.other.zc",
          "match": "\\b(as|unchecked|asm|quote|sizeof|typeof|len|cap|push|pop|resize|o3|include|embed|memdebug|fixed|typecheck)\\b"
        },
        {
          "name": "keyword.operator.memory.zc",
          "match": "\\b(new|free)\\b"
        }
      ]
    },
    "types": {
      "patterns": [
        {
          "name": "storage.type.primitive.zc",
          "match": "\\b(int|char|word|bool|void|float)\\b"
        }
      ]
    },
    "builtins": {
      "patterns": [
        {
          "name": "support.function.builtin.zc",
          "match": "\\b(putc|getc|eof|halt|puts|putn|strlen|streq|wcopy|wfill|new_t|new_raw|new_oz|recycle|gc|isobj|osize|typeof_obj|live_objects|install|zdiv|zmod|zshl|mem_set|memreport|checkptr|syscall|readfile|bopen|bread|bwrite|bgetenv|ld8|st8|ld16|st16|ld32|st32|slen|sbyte|snew|sput|scat|sslice|bputs|ston|ntos|atoi|itoa|strcat|starts|env|now|writefile)\\b"
        }
      ]
    },
    "constants": {
      "patterns": [
        {
          "name": "support.constant.builtin.zc",
          "match": "\\b(MW|HEAP_LO|HEAP_HI|ZFP|GORG|FBOT|FTOP|RS0|DSLO|DSHI|SYSGATE|MAGIC|SYS_OPEN|SYS_CLOSE|SYS_READ|SYS_WRITE|SYS_GETENV|SYS_TIME)\\b"
        }
      ]
    },
    "function-declarations": {
      "patterns": [
        {
          "match": "\\bfn\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(",
          "captures": {
            "1": { "name": "entity.name.function.zc" }
          }
        }
      ]
    },
    "function-calls": {
      "patterns": [
        {
          "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(",
          "captures": {
            "1": { "name": "entity.name.function.call.zc" }
          }
        }
      ]
    },
    "operators": {
      "patterns": [
        {
          "name": "keyword.operator.comparison.zc",
          "match": "==|!=|<=|>=|<|>"
        },
        {
          "name": "keyword.operator.logical.zc",
          "match": "&&|\\|\\||!"
        },
        {
          "name": "keyword.operator.arithmetic.zc",
          "match": "\\+|-|\\*|/|%|\\+\\+|--"
        },
        {
          "name": "keyword.operator.bitwise.zc",
          "match": "&|\\||\\^|~|<<|>>"
        },
        {
          "name": "keyword.operator.assignment.zc",
          "match": "=|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>="
        },
        {
          "name": "keyword.operator.member.zc",
          "match": "->|\\."
        }
      ]
    }
  }
}