Source file tm_grammar_json5.ml

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
let lang_id = "json5"
let json = {json|{
  "displayName": "JSON5",
  "fileTypes": [
    "json5"
  ],
  "name": "json5",
  "patterns": [
    {
      "include": "#comments"
    },
    {
      "include": "#value"
    }
  ],
  "repository": {
    "array": {
      "begin": "\\[",
      "beginCaptures": {
        "0": {
          "name": "punctuation.definition.array.begin.json5"
        }
      },
      "end": "]",
      "endCaptures": {
        "0": {
          "name": "punctuation.definition.array.end.json5"
        }
      },
      "name": "meta.structure.array.json5",
      "patterns": [
        {
          "include": "#comments"
        },
        {
          "include": "#value"
        },
        {
          "match": ",",
          "name": "punctuation.separator.array.json5"
        },
        {
          "match": "[^]\\s]",
          "name": "invalid.illegal.expected-array-separator.json5"
        }
      ]
    },
    "comments": {
      "patterns": [
        {
          "match": "/{2}.*",
          "name": "comment.single.json5"
        },
        {
          "begin": "/\\*\\*(?!/)",
          "captures": {
            "0": {
              "name": "punctuation.definition.comment.json5"
            }
          },
          "end": "\\*/",
          "name": "comment.block.documentation.json5"
        },
        {
          "begin": "/\\*",
          "captures": {
            "0": {
              "name": "punctuation.definition.comment.json5"
            }
          },
          "end": "\\*/",
          "name": "comment.block.json5"
        }
      ]
    },
    "constant": {
      "match": "\\b(?:true|false|null|Infinity|NaN)\\b",
      "name": "constant.language.json5"
    },
    "infinity": {
      "match": "(-)*\\b(?:Infinity|NaN)\\b",
      "name": "constant.language.json5"
    },
    "key": {
      "name": "string.key.json5",
      "patterns": [
        {
          "include": "#stringSingle"
        },
        {
          "include": "#stringDouble"
        },
        {
          "match": "[-0-9A-Z_a-z]",
          "name": "string.key.json5"
        }
      ]
    },
    "number": {
      "patterns": [
        {
          "match": "(0x)[0-9A-f]*",
          "name": "constant.hex.numeric.json5"
        },
        {
          "match": "[+-.]?(?=[1-9]|0(?!\\d))\\d+(\\.\\d+)?([Ee][-+]?\\d+)?",
          "name": "constant.dec.numeric.json5"
        }
      ]
    },
    "object": {
      "begin": "\\{",
      "beginCaptures": {
        "0": {
          "name": "punctuation.definition.dictionary.begin.json5"
        }
      },
      "end": "}",
      "endCaptures": {
        "0": {
          "name": "punctuation.definition.dictionary.end.json5"
        }
      },
      "name": "meta.structure.dictionary.json5",
      "patterns": [
        {
          "include": "#comments"
        },
        {
          "include": "#key"
        },
        {
          "begin": ":",
          "beginCaptures": {
            "0": {
              "name": "punctuation.separator.dictionary.key-value.json5"
            }
          },
          "end": "(,)|(?=})",
          "endCaptures": {
            "1": {
              "name": "punctuation.separator.dictionary.pair.json5"
            }
          },
          "name": "meta.structure.dictionary.value.json5",
          "patterns": [
            {
              "include": "#value"
            },
            {
              "match": "[^,\\s]",
              "name": "invalid.illegal.expected-dictionary-separator.json5"
            }
          ]
        },
        {
          "match": "[^}\\s]",
          "name": "invalid.illegal.expected-dictionary-separator.json5"
        }
      ]
    },
    "stringDouble": {
      "begin": "\"",
      "beginCaptures": {
        "0": {
          "name": "punctuation.definition.string.begin.json5"
        }
      },
      "end": "\"",
      "endCaptures": {
        "0": {
          "name": "punctuation.definition.string.end.json5"
        }
      },
      "name": "string.quoted.json5",
      "patterns": [
        {
          "match": "\\\\(?:[\"/\\\\bfnrt]|u\\h{4})",
          "name": "constant.character.escape.json5"
        },
        {
          "match": "\\\\.",
          "name": "invalid.illegal.unrecognized-string-escape.json5"
        }
      ]
    },
    "stringSingle": {
      "begin": "'",
      "beginCaptures": {
        "0": {
          "name": "punctuation.definition.string.begin.json5"
        }
      },
      "end": "'",
      "endCaptures": {
        "0": {
          "name": "punctuation.definition.string.end.json5"
        }
      },
      "name": "string.quoted.json5",
      "patterns": [
        {
          "match": "\\\\(?:[\"/\\\\bfnrt]|u\\h{4})",
          "name": "constant.character.escape.json5"
        },
        {
          "match": "\\\\.",
          "name": "invalid.illegal.unrecognized-string-escape.json5"
        }
      ]
    },
    "value": {
      "patterns": [
        {
          "include": "#constant"
        },
        {
          "include": "#infinity"
        },
        {
          "include": "#number"
        },
        {
          "include": "#stringSingle"
        },
        {
          "include": "#stringDouble"
        },
        {
          "include": "#array"
        },
        {
          "include": "#object"
        }
      ]
    }
  },
  "scopeName": "source.json5"
}|json}