about summary refs log tree commit diff stats
path: root/js/baba-yaga/dev/vscode/syntaxes/baba-yaga.tmLanguage.json
blob: 9ecb3b06efce1c340b5361554a6c75aca4180c18 (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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
{
  "name": "Baba Yaga",
  "scopeName": "source.baba-yaga",
  "fileTypes": ["baba"],
  "patterns": [
    {
      "include": "#comments"
    },
    {
      "include": "#strings"
    },
    {
      "include": "#numbers"
    },
    {
      "include": "#function-types"
    },
    {
      "include": "#with-blocks"
    },
    {
      "include": "#keywords"
    },
    {
      "include": "#operators"
    },
    {
      "include": "#types"
    },
    {
      "include": "#functions"
    },
    {
      "include": "#identifiers"
    }
  ],
  "repository": {
    "comments": {
      "patterns": [
        {
          "name": "comment.line.double-slash.baba-yaga",
          "match": "//.*$"
        }
      ]
    },
    "strings": {
      "patterns": [
        {
          "name": "string.quoted.double.baba-yaga",
          "begin": "\"",
          "end": "\"",
          "patterns": [
            {
              "name": "constant.character.escape.baba-yaga",
              "match": "\\\\."
            }
          ]
        }
      ]
    },
    "numbers": {
      "patterns": [
        {
          "name": "constant.numeric.integer.baba-yaga",
          "match": "\\b\\d+\\b"
        },
        {
          "name": "constant.numeric.float.baba-yaga",
          "match": "\\b\\d+\\.\\d+\\b"
        }
      ]
    },
    "keywords": {
      "patterns": [
        {
          "name": "keyword.control.baba-yaga",
          "match": "\\b(when|then|is|Ok|Err|true|false|PI|INFINITY|and|or|xor)\\b"
        }
      ]
    },
    "with-blocks": {
      "patterns": [
        {
          "name": "keyword.control.with.baba-yaga",
          "match": "\\bwith\\b"
        },
        {
          "name": "keyword.control.with-rec.baba-yaga",
          "match": "\\bwith\\s+rec\\b"
        },
        {
          "name": "meta.with-block.baba-yaga",
          "begin": "with\\s*\\(\\s*(?:rec\\s*)?",
          "end": "\\)\\s*->",
          "beginCaptures": {
            "0": { "name": "keyword.control.with.baba-yaga" }
          },
          "endCaptures": {
            "0": { "name": "keyword.operator.arrow.baba-yaga" }
          },
          "patterns": [
            {
              "include": "#comments"
            },
            {
              "include": "#with-block-entries"
            },
            {
              "include": "#types"
            },
            {
              "include": "#operators"
            },
            {
              "include": "#identifiers"
            }
          ]
        }
      ]
    },
    "with-block-entries": {
      "patterns": [
        {
          "name": "meta.with-block-entry.baba-yaga",
          "begin": "([a-zA-Z_][a-zA-Z0-9_]*)\\s*:",
          "end": ";",
          "beginCaptures": {
            "1": { "name": "variable.other.with-local.baba-yaga" }
          },
          "endCaptures": {
            "0": { "name": "punctuation.terminator.semicolon.baba-yaga" }
          },
          "patterns": [
            {
              "include": "#comments"
            },
            {
              "include": "#when-expressions"
            },
            {
              "include": "#types"
            },
            {
              "include": "#operators"
            },
            {
              "include": "#identifiers"
            }
          ]
        }
      ]
    },
    "when-expressions": {
      "patterns": [
        {
          "name": "meta.when-expression.baba-yaga",
          "begin": "when\\s+",
          "end": ";",
          "beginCaptures": {
            "0": { "name": "keyword.control.when.baba-yaga" }
          },
          "endCaptures": {
            "0": { "name": "punctuation.terminator.semicolon.baba-yaga" }
          },
          "patterns": [
            {
              "include": "#comments"
            },
            {
              "include": "#types"
            },
            {
              "include": "#operators"
            },
            {
              "include": "#identifiers"
            }
          ]
        }
      ]
    },
    "operators": {
      "patterns": [
        {
          "name": "keyword.operator.arrow.baba-yaga",
          "match": "->"
        },
        {
          "name": "keyword.operator.baba-yaga",
          "match": "(\\+|-|\\*|/|%|=|!=|>|<|>=|<=|\\.\\.|:)"
        }
      ]
    },
    "function-types": {
      "patterns": [
        {
          "name": "meta.function-type.baba-yaga",
          "begin": "\\(",
          "end": "\\)",
          "beginCaptures": {
            "0": { "name": "punctuation.definition.type.begin.baba-yaga" }
          },
          "endCaptures": {
            "0": { "name": "punctuation.definition.type.end.baba-yaga" }
          },
          "patterns": [
            {
              "include": "#types"
            },
            {
              "include": "#operators"
            },
            {
              "include": "#function-types"
            }
          ]
        }
      ]
    },
    "types": {
      "patterns": [
        {
          "name": "storage.type.baba-yaga",
          "match": "\\b(Bool|Int|Float|String|List|Table|Result|Number)\\b"
        }
      ]
    },
    "functions": {
      "patterns": [
        {
          "name": "entity.name.function.declaration.baba-yaga",
          "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*:",
          "captures": {
            "1": { "name": "entity.name.function.baba-yaga" }
          }
        },
        {
          "name": "support.function.builtin.baba-yaga",
          "match": "\\b(io\\.(out|in)|map|filter|reduce|append|set|merge|shape|str\\.(concat|split|join|length|substring|replace|trim|upper|lower)|math\\.(abs|sign|floor|ceil|round|trunc|min|max|clamp|pow|sqrt|exp|log|sin|cos|tan|asin|acos|atan|atan2|deg|rad|random|randomInt))\\b"
        }
      ]
    },
    "identifiers": {
      "patterns": [
        {
          "name": "variable.other.baba-yaga",
          "match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
        }
      ]
    }
  }
}