/ duper-vs-code / syntaxes / duper.tmLanguage.json
duper.tmLanguage.json
  1  {
  2    "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
  3    "name": "Duper",
  4    "scopeName": "source.duper",
  5    "aliases": ["duper"],
  6    "patterns": [
  7      {
  8        "include": "#values"
  9      },
 10      {
 11        "include": "#identifiers"
 12      }
 13    ],
 14    "repository": {
 15      "keywords": {
 16        "patterns": [
 17          {
 18            "name": "keyword.keyword.duper",
 19            "match": "\\b(true|false|null)\\b"
 20          }
 21        ]
 22      },
 23      "strings": {
 24        "patterns": [
 25          {
 26            "name": "string.quoted.double.raw.duper",
 27            "begin": "b?r(#*)\"",
 28            "beginCaptures": {
 29              "1": {
 30                "name": "punctuation.definition.string.raw.duper"
 31              }
 32            },
 33            "end": "\"(\\1)",
 34            "endCaptures": {
 35              "1": {
 36                "name": "punctuation.definition.string.raw.duper"
 37              }
 38            }
 39          },
 40          {
 41            "name": "string.quoted.base64.duper",
 42            "begin": "b64\"",
 43            "end": "\"",
 44            "patterns": [
 45              {
 46                "name": "string.quoted.base64content.duper",
 47                "match": "\\s*[A-Za-z0-9+/=]+\\s*"
 48              }
 49            ]
 50          },
 51          {
 52            "name": "string.quoted.double.duper",
 53            "begin": "b?\"",
 54            "end": "\"",
 55            "patterns": [
 56              {
 57                "include": "#stringescapes"
 58              },
 59              {
 60                "match": ".",
 61                "name": "string.quoted.content.duper"
 62              }
 63            ]
 64          },
 65          {
 66            "name": "constant.other.temporal.duper",
 67            "begin": "'",
 68            "end": "'",
 69            "patterns": [
 70              {
 71                "match": "."
 72              }
 73            ]
 74          }
 75        ]
 76      },
 77      "stringescapes": {
 78        "patterns": [
 79          {
 80            "name": "constant.character.escape.duper",
 81            "match": "\\\\([\\\\\"\\/bfnrt0]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})"
 82          },
 83          {
 84            "name": "invalid.illegal.unrecognized-string-escape.duper",
 85            "match": "\\\\."
 86          }
 87        ]
 88      },
 89      "identifiers": {
 90        "patterns": [
 91          {
 92            "begin": "([A-Z](?:[_-]?[A-Za-z0-9])*)(\\()",
 93            "beginCaptures": {
 94              "1": {
 95                "name": "entity.name.type.duper"
 96              },
 97              "2": {
 98                "name": "punctuation.definition.identifiers.duper"
 99              }
100            },
101            "end": "(\\))",
102            "endCaptures": {
103              "1": {
104                "name": "punctuation.definition.identifiers.duper"
105              }
106            },
107            "patterns": [
108              {
109                "begin": "([A-Z](?:[_-]?[A-Za-z0-9])*)(\\()",
110                "beginCaptures": {
111                  "1": {
112                    "name": "invalid.illegal.nested-identifier.duper"
113                  },
114                  "2": {
115                    "name": "invalid.illegal.nested-identifier.duper"
116                  }
117                },
118                "end": "(\\))",
119                "endCaptures": {
120                  "1": {
121                    "name": "invalid.illegal.nested-identifier.duper"
122                  }
123                },
124                "patterns": [
125                  {
126                    "include": "#values"
127                  }
128                ]
129              },
130              {
131                "include": "#values"
132              }
133            ]
134          }
135        ]
136      },
137      "numbers": {
138        "patterns": [
139          {
140            "name": "constant.numeric.duper",
141            "match": "0x[0-9a-fA-F](_?[0-9a-fA-F])*|0o[0-7](_?[0-7])*|0b[0-7](_?[0-1])*|[+-]?(0|[1-9](_?[0-9])*)(\\.[0-9](_?[0-9])*)?(([eE][+-]?[0-9](_?[0-9])*)?)?"
142          }
143        ]
144      },
145      "comments": {
146        "patterns": [
147          {
148            "name": "comment.line.duper",
149            "match": "(//).*$\\n?"
150          }
151        ]
152      },
153      "multilinecomments": {
154        "patterns": [
155          {
156            "name": "comment.block.duper",
157            "begin": "(/\\*)(?:\\s*((@)internal)(?=\\s|(\\*/)))?",
158            "end": "\\*/",
159            "patterns": [
160              {
161                "include": "#multilinecomments"
162              }
163            ]
164          }
165        ]
166      },
167      "arrays": {
168        "begin": "\\[",
169        "beginCaptures": {
170          "0": {
171            "name": "punctuation.definition.arrays.duper"
172          }
173        },
174        "end": "\\]",
175        "endCaptures": {
176          "0": {
177            "name": "punctuation.definition.arrays.duper"
178          }
179        },
180        "patterns": [
181          {
182            "include": "#values"
183          },
184          {
185            "include": "#comments"
186          },
187          {
188            "include": "#multilinecomments"
189          },
190          {
191            "match": ",",
192            "name": "punctuation.separator.arrays.duper"
193          },
194          {
195            "match": "[^\\s\\]]",
196            "name": "invalid.illegal.expected-arrays-separator.duper"
197          }
198        ]
199      },
200      "tuples": {
201        "begin": "\\(",
202        "beginCaptures": {
203          "0": {
204            "name": "punctuation.definition.tuple.duper"
205          }
206        },
207        "end": "\\)",
208        "endCaptures": {
209          "0": {
210            "name": "punctuation.definition.tuple.duper"
211          }
212        },
213        "name": "meta.structure.tuple.duper",
214        "patterns": [
215          {
216            "include": "#values"
217          },
218          {
219            "include": "#comments"
220          },
221          {
222            "include": "#multilinecomments"
223          },
224          {
225            "match": ",",
226            "name": "punctuation.separator.tuple.duper"
227          },
228          {
229            "match": "[^\\s\\)]",
230            "name": "invalid.illegal.expected-tuple-separator.duper"
231          }
232        ]
233      },
234      "objects": {
235        "begin": "\\{",
236        "beginCaptures": {
237          "0": {
238            "name": "punctuation.definition.dictionary.duper"
239          }
240        },
241        "end": "\\}",
242        "endCaptures": {
243          "0": {
244            "name": "punctuation.definition.dictionary.duper"
245          }
246        },
247        "patterns": [
248          {
249            "include": "#objectkeys"
250          },
251          {
252            "include": "#comments"
253          },
254          {
255            "include": "#multilinecomments"
256          },
257          {
258            "begin": ":",
259            "beginCaptures": {
260              "0": {
261                "name": "punctuation.separator.dictionary.key.duper"
262              }
263            },
264            "end": "(,)|(?=\\})",
265            "endCaptures": {
266              "1": {
267                "name": "punctuation.separator.dictionary.pair.duper"
268              }
269            },
270            "name": "meta.structure.dictionary.value.duper",
271            "patterns": [
272              {
273                "include": "#values"
274              },
275              {
276                "match": "[^\\s,]",
277                "name": "invalid.illegal.expected-dictionary-separator.duper"
278              }
279            ]
280          },
281          {
282            "match": "[^\\s\\}]",
283            "name": "invalid.illegal.expected-dictionary-separator.duper"
284          }
285        ]
286      },
287      "objectkeys": {
288        "patterns": [
289          {
290            "name": "variable.name.rawkeys.duper",
291            "begin": "r(#*)\"",
292            "beginCaptures": {
293              "1": {
294                "name": "punctuation.definition.objectkeys.raw.duper"
295              }
296            },
297            "end": "\"(\\1)",
298            "endCaptures": {
299              "1": {
300                "name": "punctuation.definition.objectkeys.raw.duper"
301              }
302            }
303          },
304          {
305            "name": "variable.name.quotedkeys.duper",
306            "begin": "\"",
307            "end": "\"",
308            "patterns": [
309              {
310                "include": "#keyescapes"
311              },
312              {
313                "include": "#keycontent"
314              }
315            ]
316          },
317          {
318            "name": "variable.name.plainkeys.duper",
319            "match": "(_[A-Za-z0-9]|[A-Za-z])([_-]?[A-Za-z0-9])*"
320          }
321        ]
322      },
323      "keycontent": {
324        "patterns": [
325          {
326            "match": ".",
327            "name": "variable.name.keycontent.duper"
328          }
329        ]
330      },
331      "keyescapes": {
332        "patterns": [
333          {
334            "name": "variable.name.key-escape.duper",
335            "match": "\\\\([\\\\\"\\/bfnrt0]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})"
336          },
337          {
338            "name": "invalid.illegal.unrecognized-key-escape.duper",
339            "match": "\\\\."
340          }
341        ]
342      },
343      "values": {
344        "patterns": [
345          {
346            "include": "#keywords"
347          },
348          {
349            "include": "#numbers"
350          },
351          {
352            "include": "#identifiers"
353          },
354          {
355            "include": "#strings"
356          },
357          {
358            "include": "#objects"
359          },
360          {
361            "include": "#arrays"
362          },
363          {
364            "include": "#tuples"
365          },
366          {
367            "include": "#comments"
368          },
369          {
370            "include": "#multilinecomments"
371          }
372        ]
373      }
374    }
375  }