aboutsummaryrefslogtreecommitdiff
path: root/vendor/tree-sitter-json/src
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2023-11-07 16:42:29 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2023-11-07 16:42:29 +0100
commit9123016d9d4d6fcc39a46828513f50bb52858458 (patch)
tree0bbf78d3c8221f6ffd28613b7cf423740f4854e3 /vendor/tree-sitter-json/src
parentc0377818aa198a5b5d0d3c7697373c5b6828d5fa (diff)
downloadcrep-9123016d9d4d6fcc39a46828513f50bb52858458.tar.gz
Added tree-sitter-json vendor library
Diffstat (limited to 'vendor/tree-sitter-json/src')
-rw-r--r--vendor/tree-sitter-json/src/grammar.json535
-rw-r--r--vendor/tree-sitter-json/src/node-types.json193
-rw-r--r--vendor/tree-sitter-json/src/parser.c1086
-rw-r--r--vendor/tree-sitter-json/src/tree_sitter/parser.h224
4 files changed, 2038 insertions, 0 deletions
diff --git a/vendor/tree-sitter-json/src/grammar.json b/vendor/tree-sitter-json/src/grammar.json
new file mode 100644
index 0000000..8bb8329
--- /dev/null
+++ b/vendor/tree-sitter-json/src/grammar.json
@@ -0,0 +1,535 @@
1{
2 "name": "json",
3 "rules": {
4 "document": {
5 "type": "REPEAT",
6 "content": {
7 "type": "SYMBOL",
8 "name": "_value"
9 }
10 },
11 "_value": {
12 "type": "CHOICE",
13 "members": [
14 {
15 "type": "SYMBOL",
16 "name": "object"
17 },
18 {
19 "type": "SYMBOL",
20 "name": "array"
21 },
22 {
23 "type": "SYMBOL",
24 "name": "number"
25 },
26 {
27 "type": "SYMBOL",
28 "name": "string"
29 },
30 {
31 "type": "SYMBOL",
32 "name": "true"
33 },
34 {
35 "type": "SYMBOL",
36 "name": "false"
37 },
38 {
39 "type": "SYMBOL",
40 "name": "null"
41 }
42 ]
43 },
44 "object": {
45 "type": "SEQ",
46 "members": [
47 {
48 "type": "STRING",
49 "value": "{"
50 },
51 {
52 "type": "CHOICE",
53 "members": [
54 {
55 "type": "SEQ",
56 "members": [
57 {
58 "type": "SYMBOL",
59 "name": "pair"
60 },
61 {
62 "type": "REPEAT",
63 "content": {
64 "type": "SEQ",
65 "members": [
66 {
67 "type": "STRING",
68 "value": ","
69 },
70 {
71 "type": "SYMBOL",
72 "name": "pair"
73 }
74 ]
75 }
76 }
77 ]
78 },
79 {
80 "type": "BLANK"
81 }
82 ]
83 },
84 {
85 "type": "STRING",
86 "value": "}"
87 }
88 ]
89 },
90 "pair": {
91 "type": "SEQ",
92 "members": [
93 {
94 "type": "FIELD",
95 "name": "key",
96 "content": {
97 "type": "CHOICE",
98 "members": [
99 {
100 "type": "SYMBOL",
101 "name": "string"
102 },
103 {
104 "type": "SYMBOL",
105 "name": "number"
106 }
107 ]
108 }
109 },
110 {
111 "type": "STRING",
112 "value": ":"
113 },
114 {
115 "type": "FIELD",
116 "name": "value",
117 "content": {
118 "type": "SYMBOL",
119 "name": "_value"
120 }
121 }
122 ]
123 },
124 "array": {
125 "type": "SEQ",
126 "members": [
127 {
128 "type": "STRING",
129 "value": "["
130 },
131 {
132 "type": "CHOICE",
133 "members": [
134 {
135 "type": "SEQ",
136 "members": [
137 {
138 "type": "SYMBOL",
139 "name": "_value"
140 },
141 {
142 "type": "REPEAT",
143 "content": {
144 "type": "SEQ",
145 "members": [
146 {
147 "type": "STRING",
148 "value": ","
149 },
150 {
151 "type": "SYMBOL",
152 "name": "_value"
153 }
154 ]
155 }
156 }
157 ]
158 },
159 {
160 "type": "BLANK"
161 }
162 ]
163 },
164 {
165 "type": "STRING",
166 "value": "]"
167 }
168 ]
169 },
170 "string": {
171 "type": "CHOICE",
172 "members": [
173 {
174 "type": "SEQ",
175 "members": [
176 {
177 "type": "STRING",
178 "value": "\""
179 },
180 {
181 "type": "STRING",
182 "value": "\""
183 }
184 ]
185 },
186 {
187 "type": "SEQ",
188 "members": [
189 {
190 "type": "STRING",
191 "value": "\""
192 },
193 {
194 "type": "SYMBOL",
195 "name": "string_content"
196 },
197 {
198 "type": "STRING",
199 "value": "\""
200 }
201 ]
202 }
203 ]
204 },
205 "string_content": {
206 "type": "REPEAT1",
207 "content": {
208 "type": "CHOICE",
209 "members": [
210 {
211 "type": "IMMEDIATE_TOKEN",
212 "content": {
213 "type": "PREC",
214 "value": 1,
215 "content": {
216 "type": "PATTERN",
217 "value": "[^\\\\\"\\n]+"
218 }
219 }
220 },
221 {
222 "type": "SYMBOL",
223 "name": "escape_sequence"
224 }
225 ]
226 }
227 },
228 "escape_sequence": {
229 "type": "IMMEDIATE_TOKEN",
230 "content": {
231 "type": "SEQ",
232 "members": [
233 {
234 "type": "STRING",
235 "value": "\\"
236 },
237 {
238 "type": "PATTERN",
239 "value": "(\\\"|\\\\|\\/|b|f|n|r|t|u)"
240 }
241 ]
242 }
243 },
244 "number": {
245 "type": "TOKEN",
246 "content": {
247 "type": "CHOICE",
248 "members": [
249 {
250 "type": "SEQ",
251 "members": [
252 {
253 "type": "SEQ",
254 "members": [
255 {
256 "type": "CHOICE",
257 "members": [
258 {
259 "type": "STRING",
260 "value": "-"
261 },
262 {
263 "type": "BLANK"
264 }
265 ]
266 },
267 {
268 "type": "CHOICE",
269 "members": [
270 {
271 "type": "STRING",
272 "value": "0"
273 },
274 {
275 "type": "SEQ",
276 "members": [
277 {
278 "type": "PATTERN",
279 "value": "[1-9]"
280 },
281 {
282 "type": "CHOICE",
283 "members": [
284 {
285 "type": "PATTERN",
286 "value": "\\d+"
287 },
288 {
289 "type": "BLANK"
290 }
291 ]
292 }
293 ]
294 }
295 ]
296 }
297 ]
298 },
299 {
300 "type": "STRING",
301 "value": "."
302 },
303 {
304 "type": "CHOICE",
305 "members": [
306 {
307 "type": "PATTERN",
308 "value": "\\d+"
309 },
310 {
311 "type": "BLANK"
312 }
313 ]
314 },
315 {
316 "type": "CHOICE",
317 "members": [
318 {
319 "type": "SEQ",
320 "members": [
321 {
322 "type": "CHOICE",
323 "members": [
324 {
325 "type": "STRING",
326 "value": "e"
327 },
328 {
329 "type": "STRING",
330 "value": "E"
331 }
332 ]
333 },
334 {
335 "type": "SEQ",
336 "members": [
337 {
338 "type": "CHOICE",
339 "members": [
340 {
341 "type": "STRING",
342 "value": "-"
343 },
344 {
345 "type": "BLANK"
346 }
347 ]
348 },
349 {
350 "type": "PATTERN",
351 "value": "\\d+"
352 }
353 ]
354 }
355 ]
356 },
357 {
358 "type": "BLANK"
359 }
360 ]
361 }
362 ]
363 },
364 {
365 "type": "SEQ",
366 "members": [
367 {
368 "type": "SEQ",
369 "members": [
370 {
371 "type": "CHOICE",
372 "members": [
373 {
374 "type": "STRING",
375 "value": "-"
376 },
377 {
378 "type": "BLANK"
379 }
380 ]
381 },
382 {
383 "type": "CHOICE",
384 "members": [
385 {
386 "type": "STRING",
387 "value": "0"
388 },
389 {
390 "type": "SEQ",
391 "members": [
392 {
393 "type": "PATTERN",
394 "value": "[1-9]"
395 },
396 {
397 "type": "CHOICE",
398 "members": [
399 {
400 "type": "PATTERN",
401 "value": "\\d+"
402 },
403 {
404 "type": "BLANK"
405 }
406 ]
407 }
408 ]
409 }
410 ]
411 }
412 ]
413 },
414 {
415 "type": "CHOICE",
416 "members": [
417 {
418 "type": "SEQ",
419 "members": [
420 {
421 "type": "CHOICE",
422 "members": [
423 {
424 "type": "STRING",
425 "value": "e"
426 },
427 {
428 "type": "STRING",
429 "value": "E"
430 }
431 ]
432 },
433 {
434 "type": "SEQ",
435 "members": [
436 {
437 "type": "CHOICE",
438 "members": [
439 {
440 "type": "STRING",
441 "value": "-"
442 },
443 {
444 "type": "BLANK"
445 }
446 ]
447 },
448 {
449 "type": "PATTERN",
450 "value": "\\d+"
451 }
452 ]
453 }
454 ]
455 },
456 {
457 "type": "BLANK"
458 }
459 ]
460 }
461 ]
462 }
463 ]
464 }
465 },
466 "true": {
467 "type": "STRING",
468 "value": "true"
469 },
470 "false": {
471 "type": "STRING",
472 "value": "false"
473 },
474 "null": {
475 "type": "STRING",
476 "value": "null"
477 },
478 "comment": {
479 "type": "TOKEN",
480 "content": {
481 "type": "CHOICE",
482 "members": [
483 {
484 "type": "SEQ",
485 "members": [
486 {
487 "type": "STRING",
488 "value": "//"
489 },
490 {
491 "type": "PATTERN",
492 "value": ".*"
493 }
494 ]
495 },
496 {
497 "type": "SEQ",
498 "members": [
499 {
500 "type": "STRING",
501 "value": "/*"
502 },
503 {
504 "type": "PATTERN",
505 "value": "[^*]*\\*+([^/*][^*]*\\*+)*"
506 },
507 {
508 "type": "STRING",
509 "value": "/"
510 }
511 ]
512 }
513 ]
514 }
515 }
516 },
517 "extras": [
518 {
519 "type": "PATTERN",
520 "value": "\\s"
521 },
522 {
523 "type": "SYMBOL",
524 "name": "comment"
525 }
526 ],
527 "conflicts": [],
528 "precedences": [],
529 "externals": [],
530 "inline": [],
531 "supertypes": [
532 "_value"
533 ]
534}
535
diff --git a/vendor/tree-sitter-json/src/node-types.json b/vendor/tree-sitter-json/src/node-types.json
new file mode 100644
index 0000000..bfb2688
--- /dev/null
+++ b/vendor/tree-sitter-json/src/node-types.json
@@ -0,0 +1,193 @@
1[
2 {
3 "type": "_value",
4 "named": true,
5 "subtypes": [
6 {
7 "type": "array",
8 "named": true
9 },
10 {
11 "type": "false",
12 "named": true
13 },
14 {
15 "type": "null",
16 "named": true
17 },
18 {
19 "type": "number",
20 "named": true
21 },
22 {
23 "type": "object",
24 "named": true
25 },
26 {
27 "type": "string",
28 "named": true
29 },
30 {
31 "type": "true",
32 "named": true
33 }
34 ]
35 },
36 {
37 "type": "array",
38 "named": true,
39 "fields": {},
40 "children": {
41 "multiple": true,
42 "required": false,
43 "types": [
44 {
45 "type": "_value",
46 "named": true
47 }
48 ]
49 }
50 },
51 {
52 "type": "document",
53 "named": true,
54 "fields": {},
55 "children": {
56 "multiple": true,
57 "required": false,
58 "types": [
59 {
60 "type": "_value",
61 "named": true
62 }
63 ]
64 }
65 },
66 {
67 "type": "object",
68 "named": true,
69 "fields": {},
70 "children": {
71 "multiple": true,
72 "required": false,
73 "types": [
74 {
75 "type": "pair",
76 "named": true
77 }
78 ]
79 }
80 },
81 {
82 "type": "pair",
83 "named": true,
84 "fields": {
85 "key": {
86 "multiple": false,
87 "required": true,
88 "types": [
89 {
90 "type": "number",
91 "named": true
92 },
93 {
94 "type": "string",
95 "named": true
96 }
97 ]
98 },
99 "value": {
100 "multiple": false,
101 "required": true,
102 "types": [
103 {
104 "type": "_value",
105 "named": true
106 }
107 ]
108 }
109 }
110 },
111 {
112 "type": "string",
113 "named": true,
114 "fields": {},
115 "children": {
116 "multiple": false,
117 "required": false,
118 "types": [
119 {
120 "type": "string_content",
121 "named": true
122 }
123 ]
124 }
125 },
126 {
127 "type": "string_content",
128 "named": true,
129 "fields": {},
130 "children": {
131 "multiple": true,
132 "required": false,
133 "types": [
134 {
135 "type": "escape_sequence",
136 "named": true
137 }
138 ]
139 }
140 },
141 {
142 "type": "\"",
143 "named": false
144 },
145 {
146 "type": ",",
147 "named": false
148 },
149 {
150 "type": ":",
151 "named": false
152 },
153 {
154 "type": "[",
155 "named": false
156 },
157 {
158 "type": "]",
159 "named": false
160 },
161 {
162 "type": "comment",
163 "named": true
164 },
165 {
166 "type": "escape_sequence",
167 "named": true
168 },
169 {
170 "type": "false",
171 "named": true
172 },
173 {
174 "type": "null",
175 "named": true
176 },
177 {
178 "type": "number",
179 "named": true
180 },
181 {
182 "type": "true",
183 "named": true
184 },
185 {
186 "type": "{",
187 "named": false
188 },
189 {
190 "type": "}",
191 "named": false
192 }
193] \ No newline at end of file
diff --git a/vendor/tree-sitter-json/src/parser.c b/vendor/tree-sitter-json/src/parser.c
new file mode 100644
index 0000000..1c036f0
--- /dev/null
+++ b/vendor/tree-sitter-json/src/parser.c
@@ -0,0 +1,1086 @@
1#include "tree_sitter/parser.h"
2
3#if defined(__GNUC__) || defined(__clang__)
4#pragma GCC diagnostic push
5#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
6#endif
7
8#define LANGUAGE_VERSION 14
9#define STATE_COUNT 33
10#define LARGE_STATE_COUNT 4
11#define SYMBOL_COUNT 26
12#define ALIAS_COUNT 0
13#define TOKEN_COUNT 15
14#define EXTERNAL_TOKEN_COUNT 0
15#define FIELD_COUNT 2
16#define MAX_ALIAS_SEQUENCE_LENGTH 4
17#define PRODUCTION_ID_COUNT 2
18
19enum ts_symbol_identifiers {
20 anon_sym_LBRACE = 1,
21 anon_sym_COMMA = 2,
22 anon_sym_RBRACE = 3,
23 anon_sym_COLON = 4,
24 anon_sym_LBRACK = 5,
25 anon_sym_RBRACK = 6,
26 anon_sym_DQUOTE = 7,
27 aux_sym_string_content_token1 = 8,
28 sym_escape_sequence = 9,
29 sym_number = 10,
30 sym_true = 11,
31 sym_false = 12,
32 sym_null = 13,
33 sym_comment = 14,
34 sym_document = 15,
35 sym__value = 16,
36 sym_object = 17,
37 sym_pair = 18,
38 sym_array = 19,
39 sym_string = 20,
40 sym_string_content = 21,
41 aux_sym_document_repeat1 = 22,
42 aux_sym_object_repeat1 = 23,
43 aux_sym_array_repeat1 = 24,
44 aux_sym_string_content_repeat1 = 25,
45};
46
47static const char * const ts_symbol_names[] = {
48 [ts_builtin_sym_end] = "end",
49 [anon_sym_LBRACE] = "{",
50 [anon_sym_COMMA] = ",",
51 [anon_sym_RBRACE] = "}",
52 [anon_sym_COLON] = ":",
53 [anon_sym_LBRACK] = "[",
54 [anon_sym_RBRACK] = "]",
55 [anon_sym_DQUOTE] = "\"",
56 [aux_sym_string_content_token1] = "string_content_token1",
57 [sym_escape_sequence] = "escape_sequence",
58 [sym_number] = "number",
59 [sym_true] = "true",
60 [sym_false] = "false",
61 [sym_null] = "null",
62 [sym_comment] = "comment",
63 [sym_document] = "document",
64 [sym__value] = "_value",
65 [sym_object] = "object",
66 [sym_pair] = "pair",
67 [sym_array] = "array",
68 [sym_string] = "string",
69 [sym_string_content] = "string_content",
70 [aux_sym_document_repeat1] = "document_repeat1",
71 [aux_sym_object_repeat1] = "object_repeat1",
72 [aux_sym_array_repeat1] = "array_repeat1",
73 [aux_sym_string_content_repeat1] = "string_content_repeat1",
74};
75
76static const TSSymbol ts_symbol_map[] = {
77 [ts_builtin_sym_end] = ts_builtin_sym_end,
78 [anon_sym_LBRACE] = anon_sym_LBRACE,
79 [anon_sym_COMMA] = anon_sym_COMMA,
80 [anon_sym_RBRACE] = anon_sym_RBRACE,
81 [anon_sym_COLON] = anon_sym_COLON,
82 [anon_sym_LBRACK] = anon_sym_LBRACK,
83 [anon_sym_RBRACK] = anon_sym_RBRACK,
84 [anon_sym_DQUOTE] = anon_sym_DQUOTE,
85 [aux_sym_string_content_token1] = aux_sym_string_content_token1,
86 [sym_escape_sequence] = sym_escape_sequence,
87 [sym_number] = sym_number,
88 [sym_true] = sym_true,
89 [sym_false] = sym_false,
90 [sym_null] = sym_null,
91 [sym_comment] = sym_comment,
92 [sym_document] = sym_document,
93 [sym__value] = sym__value,
94 [sym_object] = sym_object,
95 [sym_pair] = sym_pair,
96 [sym_array] = sym_array,
97 [sym_string] = sym_string,
98 [sym_string_content] = sym_string_content,
99 [aux_sym_document_repeat1] = aux_sym_document_repeat1,
100 [aux_sym_object_repeat1] = aux_sym_object_repeat1,
101 [aux_sym_array_repeat1] = aux_sym_array_repeat1,
102 [aux_sym_string_content_repeat1] = aux_sym_string_content_repeat1,
103};
104
105static const TSSymbolMetadata ts_symbol_metadata[] = {
106 [ts_builtin_sym_end] = {
107 .visible = false,
108 .named = true,
109 },
110 [anon_sym_LBRACE] = {
111 .visible = true,
112 .named = false,
113 },
114 [anon_sym_COMMA] = {
115 .visible = true,
116 .named = false,
117 },
118 [anon_sym_RBRACE] = {
119 .visible = true,
120 .named = false,
121 },
122 [anon_sym_COLON] = {
123 .visible = true,
124 .named = false,
125 },
126 [anon_sym_LBRACK] = {
127 .visible = true,
128 .named = false,
129 },
130 [anon_sym_RBRACK] = {
131 .visible = true,
132 .named = false,
133 },
134 [anon_sym_DQUOTE] = {
135 .visible = true,
136 .named = false,
137 },
138 [aux_sym_string_content_token1] = {
139 .visible = false,
140 .named = false,
141 },
142 [sym_escape_sequence] = {
143 .visible = true,
144 .named = true,
145 },
146 [sym_number] = {
147 .visible = true,
148 .named = true,
149 },
150 [sym_true] = {
151 .visible = true,
152 .named = true,
153 },
154 [sym_false] = {
155 .visible = true,
156 .named = true,
157 },
158 [sym_null] = {
159 .visible = true,
160 .named = true,
161 },
162 [sym_comment] = {
163 .visible = true,
164 .named = true,
165 },
166 [sym_document] = {
167 .visible = true,
168 .named = true,
169 },
170 [sym__value] = {
171 .visible = false,
172 .named = true,
173 .supertype = true,
174 },
175 [sym_object] = {
176 .visible = true,
177 .named = true,
178 },
179 [sym_pair] = {
180 .visible = true,
181 .named = true,
182 },
183 [sym_array] = {
184 .visible = true,
185 .named = true,
186 },
187 [sym_string] = {
188 .visible = true,
189 .named = true,
190 },
191 [sym_string_content] = {
192 .visible = true,
193 .named = true,
194 },
195 [aux_sym_document_repeat1] = {
196 .visible = false,
197 .named = false,
198 },
199 [aux_sym_object_repeat1] = {
200 .visible = false,
201 .named = false,
202 },
203 [aux_sym_array_repeat1] = {
204 .visible = false,
205 .named = false,
206 },
207 [aux_sym_string_content_repeat1] = {
208 .visible = false,
209 .named = false,
210 },
211};
212
213enum ts_field_identifiers {
214 field_key = 1,
215 field_value = 2,
216};
217
218static const char * const ts_field_names[] = {
219 [0] = NULL,
220 [field_key] = "key",
221 [field_value] = "value",
222};
223
224static const TSFieldMapSlice ts_field_map_slices[PRODUCTION_ID_COUNT] = {
225 [1] = {.index = 0, .length = 2},
226};
227
228static const TSFieldMapEntry ts_field_map_entries[] = {
229 [0] =
230 {field_key, 0},
231 {field_value, 2},
232};
233
234static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = {
235 [0] = {0},
236};
237
238static const uint16_t ts_non_terminal_alias_map[] = {
239 0,
240};
241
242static const TSStateId ts_primary_state_ids[STATE_COUNT] = {
243 [0] = 0,
244 [1] = 1,
245 [2] = 2,
246 [3] = 3,
247 [4] = 4,
248 [5] = 5,
249 [6] = 6,
250 [7] = 7,
251 [8] = 8,
252 [9] = 9,
253 [10] = 10,
254 [11] = 11,
255 [12] = 12,
256 [13] = 13,
257 [14] = 14,
258 [15] = 15,
259 [16] = 16,
260 [17] = 17,
261 [18] = 18,
262 [19] = 19,
263 [20] = 20,
264 [21] = 21,
265 [22] = 22,
266 [23] = 23,
267 [24] = 24,
268 [25] = 25,
269 [26] = 26,
270 [27] = 27,
271 [28] = 28,
272 [29] = 29,
273 [30] = 30,
274 [31] = 31,
275 [32] = 32,
276};
277
278static bool ts_lex(TSLexer *lexer, TSStateId state) {
279 START_LEXER();
280 switch (state) {
281 case 0:
282 if (eof) ADVANCE(21);
283 if (lookahead == '"') ADVANCE(28);
284 if (lookahead == ',') ADVANCE(23);
285 if (lookahead == '-') ADVANCE(7);
286 if (lookahead == '/') ADVANCE(3);
287 if (lookahead == '0') ADVANCE(35);
288 if (lookahead == ':') ADVANCE(25);
289 if (lookahead == '[') ADVANCE(26);
290 if (lookahead == '\\') ADVANCE(18);
291 if (lookahead == ']') ADVANCE(27);
292 if (lookahead == 'f') ADVANCE(8);
293 if (lookahead == 'n') ADVANCE(17);
294 if (lookahead == 't') ADVANCE(14);
295 if (lookahead == '{') ADVANCE(22);
296 if (lookahead == '}') ADVANCE(24);
297 if (('\t' <= lookahead && lookahead <= '\r') ||
298 lookahead == ' ') SKIP(20)
299 if (('1' <= lookahead && lookahead <= '9')) ADVANCE(36);
300 END_STATE();
301 case 1:
302 if (lookahead == '\n') SKIP(2)
303 if (lookahead == '"') ADVANCE(28);
304 if (lookahead == '/') ADVANCE(29);
305 if (lookahead == '\\') ADVANCE(18);
306 if (('\t' <= lookahead && lookahead <= '\r') ||
307 lookahead == ' ') ADVANCE(32);
308 if (lookahead != 0) ADVANCE(33);
309 END_STATE();
310 case 2:
311 if (lookahead == '"') ADVANCE(28);
312 if (lookahead == '/') ADVANCE(3);
313 if (('\t' <= lookahead && lookahead <= '\r') ||
314 lookahead == ' ') SKIP(2)
315 END_STATE();
316 case 3:
317 if (lookahead == '*') ADVANCE(5);
318 if (lookahead == '/') ADVANCE(43);
319 END_STATE();
320 case 4:
321 if (lookahead == '*') ADVANCE(4);
322 if (lookahead == '/') ADVANCE(42);
323 if (lookahead != 0) ADVANCE(5);
324 END_STATE();
325 case 5:
326 if (lookahead == '*') ADVANCE(4);
327 if (lookahead != 0) ADVANCE(5);
328 END_STATE();
329 case 6:
330 if (lookahead == '-') ADVANCE(19);
331 if (('0' <= lookahead && lookahead <= '9')) ADVANCE(38);
332 END_STATE();
333 case 7:
334 if (lookahead == '0') ADVANCE(35);
335 if (('1' <= lookahead && lookahead <= '9')) ADVANCE(36);
336 END_STATE();
337 case 8:
338 if (lookahead == 'a') ADVANCE(11);
339 END_STATE();
340 case 9:
341 if (lookahead == 'e') ADVANCE(39);
342 END_STATE();
343 case 10:
344 if (lookahead == 'e') ADVANCE(40);
345 END_STATE();
346 case 11:
347 if (lookahead == 'l') ADVANCE(15);
348 END_STATE();
349 case 12:
350 if (lookahead == 'l') ADVANCE(41);
351 END_STATE();
352 case 13:
353 if (lookahead == 'l') ADVANCE(12);
354 END_STATE();
355 case 14:
356 if (lookahead == 'r') ADVANCE(16);
357 END_STATE();
358 case 15:
359 if (lookahead == 's') ADVANCE(10);
360 END_STATE();
361 case 16:
362 if (lookahead == 'u') ADVANCE(9);
363 END_STATE();
364 case 17:
365 if (lookahead == 'u') ADVANCE(13);
366 END_STATE();
367 case 18:
368 if (lookahead == '"' ||
369 lookahead == '/' ||
370 lookahead == '\\' ||
371 lookahead == 'b' ||
372 lookahead == 'f' ||
373 lookahead == 'n' ||
374 lookahead == 'r' ||
375 lookahead == 't' ||
376 lookahead == 'u') ADVANCE(34);
377 END_STATE();
378 case 19:
379 if (('0' <= lookahead && lookahead <= '9')) ADVANCE(38);
380 END_STATE();
381 case 20:
382 if (eof) ADVANCE(21);
383 if (lookahead == '"') ADVANCE(28);
384 if (lookahead == ',') ADVANCE(23);
385 if (lookahead == '-') ADVANCE(7);
386 if (lookahead == '/') ADVANCE(3);
387 if (lookahead == '0') ADVANCE(35);
388 if (lookahead == ':') ADVANCE(25);
389 if (lookahead == '[') ADVANCE(26);
390 if (lookahead == ']') ADVANCE(27);
391 if (lookahead == 'f') ADVANCE(8);
392 if (lookahead == 'n') ADVANCE(17);
393 if (lookahead == 't') ADVANCE(14);
394 if (lookahead == '{') ADVANCE(22);
395 if (lookahead == '}') ADVANCE(24);
396 if (('\t' <= lookahead && lookahead <= '\r') ||
397 lookahead == ' ') SKIP(20)
398 if (('1' <= lookahead && lookahead <= '9')) ADVANCE(36);
399 END_STATE();
400 case 21:
401 ACCEPT_TOKEN(ts_builtin_sym_end);
402 END_STATE();
403 case 22:
404 ACCEPT_TOKEN(anon_sym_LBRACE);
405 END_STATE();
406 case 23:
407 ACCEPT_TOKEN(anon_sym_COMMA);
408 END_STATE();
409 case 24:
410 ACCEPT_TOKEN(anon_sym_RBRACE);
411 END_STATE();
412 case 25:
413 ACCEPT_TOKEN(anon_sym_COLON);
414 END_STATE();
415 case 26:
416 ACCEPT_TOKEN(anon_sym_LBRACK);
417 END_STATE();
418 case 27:
419 ACCEPT_TOKEN(anon_sym_RBRACK);
420 END_STATE();
421 case 28:
422 ACCEPT_TOKEN(anon_sym_DQUOTE);
423 END_STATE();
424 case 29:
425 ACCEPT_TOKEN(aux_sym_string_content_token1);
426 if (lookahead == '*') ADVANCE(31);
427 if (lookahead == '/') ADVANCE(33);
428 if (lookahead != 0 &&
429 lookahead != '\n' &&
430 lookahead != '"' &&
431 lookahead != '\\') ADVANCE(33);
432 END_STATE();
433 case 30:
434 ACCEPT_TOKEN(aux_sym_string_content_token1);
435 if (lookahead == '*') ADVANCE(30);
436 if (lookahead == '/') ADVANCE(33);
437 if (lookahead != 0 &&
438 lookahead != '\n' &&
439 lookahead != '"' &&
440 lookahead != '\\') ADVANCE(31);
441 END_STATE();
442 case 31:
443 ACCEPT_TOKEN(aux_sym_string_content_token1);
444 if (lookahead == '*') ADVANCE(30);
445 if (lookahead != 0 &&
446 lookahead != '\n' &&
447 lookahead != '"' &&
448 lookahead != '\\') ADVANCE(31);
449 END_STATE();
450 case 32:
451 ACCEPT_TOKEN(aux_sym_string_content_token1);
452 if (lookahead == '/') ADVANCE(29);
453 if (lookahead == '\t' ||
454 (11 <= lookahead && lookahead <= '\r') ||
455 lookahead == ' ') ADVANCE(32);
456 if (lookahead != 0 &&
457 lookahead != '\n' &&
458 lookahead != '"' &&
459 lookahead != '\\') ADVANCE(33);
460 END_STATE();
461 case 33:
462 ACCEPT_TOKEN(aux_sym_string_content_token1);
463 if (lookahead != 0 &&
464 lookahead != '\n' &&
465 lookahead != '"' &&
466 lookahead != '\\') ADVANCE(33);
467 END_STATE();
468 case 34:
469 ACCEPT_TOKEN(sym_escape_sequence);
470 END_STATE();
471 case 35:
472 ACCEPT_TOKEN(sym_number);
473 if (lookahead == '.') ADVANCE(37);
474 if (lookahead == 'E' ||
475 lookahead == 'e') ADVANCE(6);
476 END_STATE();
477 case 36:
478 ACCEPT_TOKEN(sym_number);
479 if (lookahead == '.') ADVANCE(37);
480 if (lookahead == 'E' ||
481 lookahead == 'e') ADVANCE(6);
482 if (('0' <= lookahead && lookahead <= '9')) ADVANCE(36);
483 END_STATE();
484 case 37:
485 ACCEPT_TOKEN(sym_number);
486 if (lookahead == 'E' ||
487 lookahead == 'e') ADVANCE(6);
488 if (('0' <= lookahead && lookahead <= '9')) ADVANCE(37);
489 END_STATE();
490 case 38:
491 ACCEPT_TOKEN(sym_number);
492 if (('0' <= lookahead && lookahead <= '9')) ADVANCE(38);
493 END_STATE();
494 case 39:
495 ACCEPT_TOKEN(sym_true);
496 END_STATE();
497 case 40:
498 ACCEPT_TOKEN(sym_false);
499 END_STATE();
500 case 41:
501 ACCEPT_TOKEN(sym_null);
502 END_STATE();
503 case 42:
504 ACCEPT_TOKEN(sym_comment);
505 END_STATE();
506 case 43:
507 ACCEPT_TOKEN(sym_comment);
508 if (lookahead != 0 &&
509 lookahead != '\n') ADVANCE(43);
510 END_STATE();
511 default:
512 return false;
513 }
514}
515
516static const TSLexMode ts_lex_modes[STATE_COUNT] = {
517 [0] = {.lex_state = 0},
518 [1] = {.lex_state = 0},
519 [2] = {.lex_state = 0},
520 [3] = {.lex_state = 0},
521 [4] = {.lex_state = 0},
522 [5] = {.lex_state = 0},
523 [6] = {.lex_state = 0},
524 [7] = {.lex_state = 0},
525 [8] = {.lex_state = 0},
526 [9] = {.lex_state = 0},
527 [10] = {.lex_state = 0},
528 [11] = {.lex_state = 0},
529 [12] = {.lex_state = 0},
530 [13] = {.lex_state = 0},
531 [14] = {.lex_state = 0},
532 [15] = {.lex_state = 0},
533 [16] = {.lex_state = 1},
534 [17] = {.lex_state = 0},
535 [18] = {.lex_state = 1},
536 [19] = {.lex_state = 1},
537 [20] = {.lex_state = 0},
538 [21] = {.lex_state = 0},
539 [22] = {.lex_state = 0},
540 [23] = {.lex_state = 0},
541 [24] = {.lex_state = 0},
542 [25] = {.lex_state = 0},
543 [26] = {.lex_state = 0},
544 [27] = {.lex_state = 0},
545 [28] = {.lex_state = 0},
546 [29] = {.lex_state = 0},
547 [30] = {.lex_state = 0},
548 [31] = {.lex_state = 0},
549 [32] = {.lex_state = 0},
550};
551
552static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
553 [0] = {
554 [ts_builtin_sym_end] = ACTIONS(1),
555 [anon_sym_LBRACE] = ACTIONS(1),
556 [anon_sym_COMMA] = ACTIONS(1),
557 [anon_sym_RBRACE] = ACTIONS(1),
558 [anon_sym_COLON] = ACTIONS(1),
559 [anon_sym_LBRACK] = ACTIONS(1),
560 [anon_sym_RBRACK] = ACTIONS(1),
561 [anon_sym_DQUOTE] = ACTIONS(1),
562 [sym_escape_sequence] = ACTIONS(1),
563 [sym_number] = ACTIONS(1),
564 [sym_true] = ACTIONS(1),
565 [sym_false] = ACTIONS(1),
566 [sym_null] = ACTIONS(1),
567 [sym_comment] = ACTIONS(3),
568 },
569 [1] = {
570 [sym_document] = STATE(30),
571 [sym__value] = STATE(2),
572 [sym_object] = STATE(8),
573 [sym_array] = STATE(8),
574 [sym_string] = STATE(8),
575 [aux_sym_document_repeat1] = STATE(2),
576 [ts_builtin_sym_end] = ACTIONS(5),
577 [anon_sym_LBRACE] = ACTIONS(7),
578 [anon_sym_LBRACK] = ACTIONS(9),
579 [anon_sym_DQUOTE] = ACTIONS(11),
580 [sym_number] = ACTIONS(13),
581 [sym_true] = ACTIONS(13),
582 [sym_false] = ACTIONS(13),
583 [sym_null] = ACTIONS(13),
584 [sym_comment] = ACTIONS(3),
585 },
586 [2] = {
587 [sym__value] = STATE(3),
588 [sym_object] = STATE(8),
589 [sym_array] = STATE(8),
590 [sym_string] = STATE(8),
591 [aux_sym_document_repeat1] = STATE(3),
592 [ts_builtin_sym_end] = ACTIONS(15),
593 [anon_sym_LBRACE] = ACTIONS(7),
594 [anon_sym_LBRACK] = ACTIONS(9),
595 [anon_sym_DQUOTE] = ACTIONS(11),
596 [sym_number] = ACTIONS(13),
597 [sym_true] = ACTIONS(13),
598 [sym_false] = ACTIONS(13),
599 [sym_null] = ACTIONS(13),
600 [sym_comment] = ACTIONS(3),
601 },
602 [3] = {
603 [sym__value] = STATE(3),
604 [sym_object] = STATE(8),
605 [sym_array] = STATE(8),
606 [sym_string] = STATE(8),
607 [aux_sym_document_repeat1] = STATE(3),
608 [ts_builtin_sym_end] = ACTIONS(17),
609 [anon_sym_LBRACE] = ACTIONS(19),
610 [anon_sym_LBRACK] = ACTIONS(22),
611 [anon_sym_DQUOTE] = ACTIONS(25),
612 [sym_number] = ACTIONS(28),
613 [sym_true] = ACTIONS(28),
614 [sym_false] = ACTIONS(28),
615 [sym_null] = ACTIONS(28),
616 [sym_comment] = ACTIONS(3),
617 },
618};
619
620static const uint16_t ts_small_parse_table[] = {
621 [0] = 2,
622 ACTIONS(3), 1,
623 sym_comment,
624 ACTIONS(31), 12,
625 ts_builtin_sym_end,
626 anon_sym_LBRACE,
627 anon_sym_COMMA,
628 anon_sym_RBRACE,
629 anon_sym_COLON,
630 anon_sym_LBRACK,
631 anon_sym_RBRACK,
632 anon_sym_DQUOTE,
633 sym_number,
634 sym_true,
635 sym_false,
636 sym_null,
637 [18] = 2,
638 ACTIONS(3), 1,
639 sym_comment,
640 ACTIONS(33), 12,
641 ts_builtin_sym_end,
642 anon_sym_LBRACE,
643 anon_sym_COMMA,
644 anon_sym_RBRACE,
645 anon_sym_COLON,
646 anon_sym_LBRACK,
647 anon_sym_RBRACK,
648 anon_sym_DQUOTE,
649 sym_number,
650 sym_true,
651 sym_false,
652 sym_null,
653 [36] = 8,
654 ACTIONS(3), 1,
655 sym_comment,
656 ACTIONS(7), 1,
657 anon_sym_LBRACE,
658 ACTIONS(9), 1,
659 anon_sym_LBRACK,
660 ACTIONS(11), 1,
661 anon_sym_DQUOTE,
662 ACTIONS(35), 1,
663 anon_sym_RBRACK,
664 STATE(21), 1,
665 sym__value,
666 STATE(8), 3,
667 sym_object,
668 sym_array,
669 sym_string,
670 ACTIONS(13), 4,
671 sym_number,
672 sym_true,
673 sym_false,
674 sym_null,
675 [66] = 2,
676 ACTIONS(3), 1,
677 sym_comment,
678 ACTIONS(37), 11,
679 ts_builtin_sym_end,
680 anon_sym_LBRACE,
681 anon_sym_COMMA,
682 anon_sym_RBRACE,
683 anon_sym_LBRACK,
684 anon_sym_RBRACK,
685 anon_sym_DQUOTE,
686 sym_number,
687 sym_true,
688 sym_false,
689 sym_null,
690 [83] = 2,
691 ACTIONS(3), 1,
692 sym_comment,
693 ACTIONS(39), 11,
694 ts_builtin_sym_end,
695 anon_sym_LBRACE,
696 anon_sym_COMMA,
697 anon_sym_RBRACE,
698 anon_sym_LBRACK,
699 anon_sym_RBRACK,
700 anon_sym_DQUOTE,
701 sym_number,
702 sym_true,
703 sym_false,
704 sym_null,
705 [100] = 2,
706 ACTIONS(3), 1,
707 sym_comment,
708 ACTIONS(41), 11,
709 ts_builtin_sym_end,
710 anon_sym_LBRACE,
711 anon_sym_COMMA,
712 anon_sym_RBRACE,
713 anon_sym_LBRACK,
714 anon_sym_RBRACK,
715 anon_sym_DQUOTE,
716 sym_number,
717 sym_true,
718 sym_false,
719 sym_null,
720 [117] = 2,
721 ACTIONS(3), 1,
722 sym_comment,
723 ACTIONS(43), 11,
724 ts_builtin_sym_end,
725 anon_sym_LBRACE,
726 anon_sym_COMMA,
727 anon_sym_RBRACE,
728 anon_sym_LBRACK,
729 anon_sym_RBRACK,
730 anon_sym_DQUOTE,
731 sym_number,
732 sym_true,
733 sym_false,
734 sym_null,
735 [134] = 2,
736 ACTIONS(3), 1,
737 sym_comment,
738 ACTIONS(45), 11,
739 ts_builtin_sym_end,
740 anon_sym_LBRACE,
741 anon_sym_COMMA,
742 anon_sym_RBRACE,
743 anon_sym_LBRACK,
744 anon_sym_RBRACK,
745 anon_sym_DQUOTE,
746 sym_number,
747 sym_true,
748 sym_false,
749 sym_null,
750 [151] = 2,
751 ACTIONS(3), 1,
752 sym_comment,
753 ACTIONS(47), 11,
754 ts_builtin_sym_end,
755 anon_sym_LBRACE,
756 anon_sym_COMMA,
757 anon_sym_RBRACE,
758 anon_sym_LBRACK,
759 anon_sym_RBRACK,
760 anon_sym_DQUOTE,
761 sym_number,
762 sym_true,
763 sym_false,
764 sym_null,
765 [168] = 7,
766 ACTIONS(3), 1,
767 sym_comment,
768 ACTIONS(7), 1,
769 anon_sym_LBRACE,
770 ACTIONS(9), 1,
771 anon_sym_LBRACK,
772 ACTIONS(11), 1,
773 anon_sym_DQUOTE,
774 STATE(27), 1,
775 sym__value,
776 STATE(8), 3,
777 sym_object,
778 sym_array,
779 sym_string,
780 ACTIONS(13), 4,
781 sym_number,
782 sym_true,
783 sym_false,
784 sym_null,
785 [195] = 2,
786 ACTIONS(3), 1,
787 sym_comment,
788 ACTIONS(49), 11,
789 ts_builtin_sym_end,
790 anon_sym_LBRACE,
791 anon_sym_COMMA,
792 anon_sym_RBRACE,
793 anon_sym_LBRACK,
794 anon_sym_RBRACK,
795 anon_sym_DQUOTE,
796 sym_number,
797 sym_true,
798 sym_false,
799 sym_null,
800 [212] = 7,
801 ACTIONS(3), 1,
802 sym_comment,
803 ACTIONS(7), 1,
804 anon_sym_LBRACE,
805 ACTIONS(9), 1,
806 anon_sym_LBRACK,
807 ACTIONS(11), 1,
808 anon_sym_DQUOTE,
809 STATE(29), 1,
810 sym__value,
811 STATE(8), 3,
812 sym_object,
813 sym_array,
814 sym_string,
815 ACTIONS(13), 4,
816 sym_number,
817 sym_true,
818 sym_false,
819 sym_null,
820 [239] = 5,
821 ACTIONS(51), 1,
822 anon_sym_DQUOTE,
823 ACTIONS(55), 1,
824 sym_comment,
825 STATE(19), 1,
826 aux_sym_string_content_repeat1,
827 STATE(31), 1,
828 sym_string_content,
829 ACTIONS(53), 2,
830 aux_sym_string_content_token1,
831 sym_escape_sequence,
832 [256] = 6,
833 ACTIONS(3), 1,
834 sym_comment,
835 ACTIONS(11), 1,
836 anon_sym_DQUOTE,
837 ACTIONS(57), 1,
838 anon_sym_RBRACE,
839 ACTIONS(59), 1,
840 sym_number,
841 STATE(24), 1,
842 sym_pair,
843 STATE(32), 1,
844 sym_string,
845 [275] = 4,
846 ACTIONS(55), 1,
847 sym_comment,
848 ACTIONS(61), 1,
849 anon_sym_DQUOTE,
850 STATE(18), 1,
851 aux_sym_string_content_repeat1,
852 ACTIONS(63), 2,
853 aux_sym_string_content_token1,
854 sym_escape_sequence,
855 [289] = 4,
856 ACTIONS(55), 1,
857 sym_comment,
858 ACTIONS(66), 1,
859 anon_sym_DQUOTE,
860 STATE(18), 1,
861 aux_sym_string_content_repeat1,
862 ACTIONS(68), 2,
863 aux_sym_string_content_token1,
864 sym_escape_sequence,
865 [303] = 5,
866 ACTIONS(3), 1,
867 sym_comment,
868 ACTIONS(11), 1,
869 anon_sym_DQUOTE,
870 ACTIONS(59), 1,
871 sym_number,
872 STATE(28), 1,
873 sym_pair,
874 STATE(32), 1,
875 sym_string,
876 [319] = 4,
877 ACTIONS(3), 1,
878 sym_comment,
879 ACTIONS(70), 1,
880 anon_sym_COMMA,
881 ACTIONS(72), 1,
882 anon_sym_RBRACK,
883 STATE(23), 1,
884 aux_sym_array_repeat1,
885 [332] = 4,
886 ACTIONS(3), 1,
887 sym_comment,
888 ACTIONS(74), 1,
889 anon_sym_COMMA,
890 ACTIONS(76), 1,
891 anon_sym_RBRACE,
892 STATE(25), 1,
893 aux_sym_object_repeat1,
894 [345] = 4,
895 ACTIONS(3), 1,
896 sym_comment,
897 ACTIONS(70), 1,
898 anon_sym_COMMA,
899 ACTIONS(78), 1,
900 anon_sym_RBRACK,
901 STATE(26), 1,
902 aux_sym_array_repeat1,
903 [358] = 4,
904 ACTIONS(3), 1,
905 sym_comment,
906 ACTIONS(74), 1,
907 anon_sym_COMMA,
908 ACTIONS(80), 1,
909 anon_sym_RBRACE,
910 STATE(22), 1,
911 aux_sym_object_repeat1,
912 [371] = 4,
913 ACTIONS(3), 1,
914 sym_comment,
915 ACTIONS(82), 1,
916 anon_sym_COMMA,
917 ACTIONS(85), 1,
918 anon_sym_RBRACE,
919 STATE(25), 1,
920 aux_sym_object_repeat1,
921 [384] = 4,
922 ACTIONS(3), 1,
923 sym_comment,
924 ACTIONS(87), 1,
925 anon_sym_COMMA,
926 ACTIONS(90), 1,
927 anon_sym_RBRACK,
928 STATE(26), 1,
929 aux_sym_array_repeat1,
930 [397] = 2,
931 ACTIONS(3), 1,
932 sym_comment,
933 ACTIONS(92), 2,
934 anon_sym_COMMA,
935 anon_sym_RBRACE,
936 [405] = 2,
937 ACTIONS(3), 1,
938 sym_comment,
939 ACTIONS(85), 2,
940 anon_sym_COMMA,
941 anon_sym_RBRACE,
942 [413] = 2,
943 ACTIONS(3), 1,
944 sym_comment,
945 ACTIONS(90), 2,
946 anon_sym_COMMA,
947 anon_sym_RBRACK,
948 [421] = 2,
949 ACTIONS(3), 1,
950 sym_comment,
951 ACTIONS(94), 1,
952 ts_builtin_sym_end,
953 [428] = 2,
954 ACTIONS(3), 1,
955 sym_comment,
956 ACTIONS(96), 1,
957 anon_sym_DQUOTE,
958 [435] = 2,
959 ACTIONS(3), 1,
960 sym_comment,
961 ACTIONS(98), 1,
962 anon_sym_COLON,
963};
964
965static const uint32_t ts_small_parse_table_map[] = {
966 [SMALL_STATE(4)] = 0,
967 [SMALL_STATE(5)] = 18,
968 [SMALL_STATE(6)] = 36,
969 [SMALL_STATE(7)] = 66,
970 [SMALL_STATE(8)] = 83,
971 [SMALL_STATE(9)] = 100,
972 [SMALL_STATE(10)] = 117,
973 [SMALL_STATE(11)] = 134,
974 [SMALL_STATE(12)] = 151,
975 [SMALL_STATE(13)] = 168,
976 [SMALL_STATE(14)] = 195,
977 [SMALL_STATE(15)] = 212,
978 [SMALL_STATE(16)] = 239,
979 [SMALL_STATE(17)] = 256,
980 [SMALL_STATE(18)] = 275,
981 [SMALL_STATE(19)] = 289,
982 [SMALL_STATE(20)] = 303,
983 [SMALL_STATE(21)] = 319,
984 [SMALL_STATE(22)] = 332,
985 [SMALL_STATE(23)] = 345,
986 [SMALL_STATE(24)] = 358,
987 [SMALL_STATE(25)] = 371,
988 [SMALL_STATE(26)] = 384,
989 [SMALL_STATE(27)] = 397,
990 [SMALL_STATE(28)] = 405,
991 [SMALL_STATE(29)] = 413,
992 [SMALL_STATE(30)] = 421,
993 [SMALL_STATE(31)] = 428,
994 [SMALL_STATE(32)] = 435,
995};
996
997static const TSParseActionEntry ts_parse_actions[] = {
998 [0] = {.entry = {.count = 0, .reusable = false}},
999 [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(),
1000 [3] = {.entry = {.count = 1, .reusable = true}}, SHIFT_EXTRA(),
1001 [5] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 0),
1002 [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17),
1003 [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6),
1004 [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16),
1005 [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8),
1006 [15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 1),
1007 [17] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2),
1008 [19] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2), SHIFT_REPEAT(17),
1009 [22] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2), SHIFT_REPEAT(6),
1010 [25] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2), SHIFT_REPEAT(16),
1011 [28] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2), SHIFT_REPEAT(8),
1012 [31] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 3),
1013 [33] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 2),
1014 [35] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12),
1015 [37] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array, 3),
1016 [39] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__value, 1),
1017 [41] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array, 4),
1018 [43] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_object, 2),
1019 [45] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_object, 4),
1020 [47] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_array, 2),
1021 [49] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_object, 3),
1022 [51] = {.entry = {.count = 1, .reusable = false}}, SHIFT(5),
1023 [53] = {.entry = {.count = 1, .reusable = true}}, SHIFT(19),
1024 [55] = {.entry = {.count = 1, .reusable = false}}, SHIFT_EXTRA(),
1025 [57] = {.entry = {.count = 1, .reusable = true}}, SHIFT(10),
1026 [59] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32),
1027 [61] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_string_content_repeat1, 2),
1028 [63] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_string_content_repeat1, 2), SHIFT_REPEAT(18),
1029 [66] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string_content, 1),
1030 [68] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18),
1031 [70] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15),
1032 [72] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7),
1033 [74] = {.entry = {.count = 1, .reusable = true}}, SHIFT(20),
1034 [76] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11),
1035 [78] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9),
1036 [80] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14),
1037 [82] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_object_repeat1, 2), SHIFT_REPEAT(20),
1038 [85] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_object_repeat1, 2),
1039 [87] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_array_repeat1, 2), SHIFT_REPEAT(15),
1040 [90] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_array_repeat1, 2),
1041 [92] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pair, 3, .production_id = 1),
1042 [94] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(),
1043 [96] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4),
1044 [98] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13),
1045};
1046
1047#ifdef __cplusplus
1048extern "C" {
1049#endif
1050#ifdef _WIN32
1051#define extern __declspec(dllexport)
1052#endif
1053
1054extern const TSLanguage *tree_sitter_json(void) {
1055 static const TSLanguage language = {
1056 .version = LANGUAGE_VERSION,
1057 .symbol_count = SYMBOL_COUNT,
1058 .alias_count = ALIAS_COUNT,
1059 .token_count = TOKEN_COUNT,
1060 .external_token_count = EXTERNAL_TOKEN_COUNT,
1061 .state_count = STATE_COUNT,
1062 .large_state_count = LARGE_STATE_COUNT,
1063 .production_id_count = PRODUCTION_ID_COUNT,
1064 .field_count = FIELD_COUNT,
1065 .max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH,
1066 .parse_table = &ts_parse_table[0][0],
1067 .small_parse_table = ts_small_parse_table,
1068 .small_parse_table_map = ts_small_parse_table_map,
1069 .parse_actions = ts_parse_actions,
1070 .symbol_names = ts_symbol_names,
1071 .field_names = ts_field_names,
1072 .field_map_slices = ts_field_map_slices,
1073 .field_map_entries = ts_field_map_entries,
1074 .symbol_metadata = ts_symbol_metadata,
1075 .public_symbol_map = ts_symbol_map,
1076 .alias_map = ts_non_terminal_alias_map,
1077 .alias_sequences = &ts_alias_sequences[0][0],
1078 .lex_modes = ts_lex_modes,
1079 .lex_fn = ts_lex,
1080 .primary_state_ids = ts_primary_state_ids,
1081 };
1082 return &language;
1083}
1084#ifdef __cplusplus
1085}
1086#endif
diff --git a/vendor/tree-sitter-json/src/tree_sitter/parser.h b/vendor/tree-sitter-json/src/tree_sitter/parser.h
new file mode 100644
index 0000000..d210325
--- /dev/null
+++ b/vendor/tree-sitter-json/src/tree_sitter/parser.h
@@ -0,0 +1,224 @@
1#ifndef TREE_SITTER_PARSER_H_
2#define TREE_SITTER_PARSER_H_
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdbool.h>
9#include <stdint.h>
10#include <stdlib.h>
11
12#define ts_builtin_sym_error ((TSSymbol)-1)
13#define ts_builtin_sym_end 0
14#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
15
16#ifndef TREE_SITTER_API_H_
17typedef uint16_t TSStateId;
18typedef uint16_t TSSymbol;
19typedef uint16_t TSFieldId;
20typedef struct TSLanguage TSLanguage;
21#endif
22
23typedef struct {
24 TSFieldId field_id;
25 uint8_t child_index;
26 bool inherited;
27} TSFieldMapEntry;
28
29typedef struct {
30 uint16_t index;
31 uint16_t length;
32} TSFieldMapSlice;
33
34typedef struct {
35 bool visible;
36 bool named;
37 bool supertype;
38} TSSymbolMetadata;
39
40typedef struct TSLexer TSLexer;
41
42struct TSLexer {
43 int32_t lookahead;
44 TSSymbol result_symbol;
45 void (*advance)(TSLexer *, bool);
46 void (*mark_end)(TSLexer *);
47 uint32_t (*get_column)(TSLexer *);
48 bool (*is_at_included_range_start)(const TSLexer *);
49 bool (*eof)(const TSLexer *);
50};
51
52typedef enum {
53 TSParseActionTypeShift,
54 TSParseActionTypeReduce,
55 TSParseActionTypeAccept,
56 TSParseActionTypeRecover,
57} TSParseActionType;
58
59typedef union {
60 struct {
61 uint8_t type;
62 TSStateId state;
63 bool extra;
64 bool repetition;
65 } shift;
66 struct {
67 uint8_t type;
68 uint8_t child_count;
69 TSSymbol symbol;
70 int16_t dynamic_precedence;
71 uint16_t production_id;
72 } reduce;
73 uint8_t type;
74} TSParseAction;
75
76typedef struct {
77 uint16_t lex_state;
78 uint16_t external_lex_state;
79} TSLexMode;
80
81typedef union {
82 TSParseAction action;
83 struct {
84 uint8_t count;
85 bool reusable;
86 } entry;
87} TSParseActionEntry;
88
89struct TSLanguage {
90 uint32_t version;
91 uint32_t symbol_count;
92 uint32_t alias_count;
93 uint32_t token_count;
94 uint32_t external_token_count;
95 uint32_t state_count;
96 uint32_t large_state_count;
97 uint32_t production_id_count;
98 uint32_t field_count;
99 uint16_t max_alias_sequence_length;
100 const uint16_t *parse_table;
101 const uint16_t *small_parse_table;
102 const uint32_t *small_parse_table_map;
103 const TSParseActionEntry *parse_actions;
104 const char * const *symbol_names;
105 const char * const *field_names;
106 const TSFieldMapSlice *field_map_slices;
107 const TSFieldMapEntry *field_map_entries;
108 const TSSymbolMetadata *symbol_metadata;
109 const TSSymbol *public_symbol_map;
110 const uint16_t *alias_map;
111 const TSSymbol *alias_sequences;
112 const TSLexMode *lex_modes;
113 bool (*lex_fn)(TSLexer *, TSStateId);
114 bool (*keyword_lex_fn)(TSLexer *, TSStateId);
115 TSSymbol keyword_capture_token;
116 struct {
117 const bool *states;
118 const TSSymbol *symbol_map;
119 void *(*create)(void);
120 void (*destroy)(void *);
121 bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist);
122 unsigned (*serialize)(void *, char *);
123 void (*deserialize)(void *, const char *, unsigned);
124 } external_scanner;
125 const TSStateId *primary_state_ids;
126};
127
128/*
129 * Lexer Macros
130 */
131
132#define START_LEXER() \
133 bool result = false; \
134 bool skip = false; \
135 bool eof = false; \
136 int32_t lookahead; \
137 goto start; \
138 next_state: \
139 lexer->advance(lexer, skip); \
140 start: \
141 skip = false; \
142 lookahead = lexer->lookahead; \
143 eof = lexer->eof(lexer);
144
145#define ADVANCE(state_value) \
146 { \
147 state = state_value; \
148 goto next_state; \
149 }
150
151#define SKIP(state_value) \
152 { \
153 skip = true; \
154 state = state_value; \
155 goto next_state; \
156 }
157
158#define ACCEPT_TOKEN(symbol_value) \
159 result = true; \
160 lexer->result_symbol = symbol_value; \
161 lexer->mark_end(lexer);
162
163#define END_STATE() return result;
164
165/*
166 * Parse Table Macros
167 */
168
169#define SMALL_STATE(id) ((id) - LARGE_STATE_COUNT)
170
171#define STATE(id) id
172
173#define ACTIONS(id) id
174
175#define SHIFT(state_value) \
176 {{ \
177 .shift = { \
178 .type = TSParseActionTypeShift, \
179 .state = (state_value) \
180 } \
181 }}
182
183#define SHIFT_REPEAT(state_value) \
184 {{ \
185 .shift = { \
186 .type = TSParseActionTypeShift, \
187 .state = (state_value), \
188 .repetition = true \
189 } \
190 }}
191
192#define SHIFT_EXTRA() \
193 {{ \
194 .shift = { \
195 .type = TSParseActionTypeShift, \
196 .extra = true \
197 } \
198 }}
199
200#define REDUCE(symbol_val, child_count_val, ...) \
201 {{ \
202 .reduce = { \
203 .type = TSParseActionTypeReduce, \
204 .symbol = symbol_val, \
205 .child_count = child_count_val, \
206 __VA_ARGS__ \
207 }, \
208 }}
209
210#define RECOVER() \
211 {{ \
212 .type = TSParseActionTypeRecover \
213 }}
214
215#define ACCEPT_INPUT() \
216 {{ \
217 .type = TSParseActionTypeAccept \
218 }}
219
220#ifdef __cplusplus
221}
222#endif
223
224#endif // TREE_SITTER_PARSER_H_