tree-sitter-ktav 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,818 @@
1
+ {
2
+ "$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json",
3
+ "name": "ktav",
4
+ "word": "_key_segment",
5
+ "rules": {
6
+ "source_file": {
7
+ "type": "REPEAT",
8
+ "content": {
9
+ "type": "SYMBOL",
10
+ "name": "_line"
11
+ }
12
+ },
13
+ "_line": {
14
+ "type": "CHOICE",
15
+ "members": [
16
+ {
17
+ "type": "SYMBOL",
18
+ "name": "comment"
19
+ },
20
+ {
21
+ "type": "SYMBOL",
22
+ "name": "blank_line"
23
+ },
24
+ {
25
+ "type": "SYMBOL",
26
+ "name": "object_pair"
27
+ }
28
+ ]
29
+ },
30
+ "blank_line": {
31
+ "type": "SYMBOL",
32
+ "name": "_newline"
33
+ },
34
+ "_newline": {
35
+ "type": "PATTERN",
36
+ "value": "\\r?\\n"
37
+ },
38
+ "comment": {
39
+ "type": "SEQ",
40
+ "members": [
41
+ {
42
+ "type": "STRING",
43
+ "value": "#"
44
+ },
45
+ {
46
+ "type": "CHOICE",
47
+ "members": [
48
+ {
49
+ "type": "PATTERN",
50
+ "value": "[^\\r\\n]*"
51
+ },
52
+ {
53
+ "type": "BLANK"
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "type": "SYMBOL",
59
+ "name": "_newline"
60
+ }
61
+ ]
62
+ },
63
+ "object_pair": {
64
+ "type": "CHOICE",
65
+ "members": [
66
+ {
67
+ "type": "SEQ",
68
+ "members": [
69
+ {
70
+ "type": "FIELD",
71
+ "name": "key",
72
+ "content": {
73
+ "type": "SYMBOL",
74
+ "name": "key"
75
+ }
76
+ },
77
+ {
78
+ "type": "FIELD",
79
+ "name": "separator",
80
+ "content": {
81
+ "type": "CHOICE",
82
+ "members": [
83
+ {
84
+ "type": "SYMBOL",
85
+ "name": "sep_raw"
86
+ },
87
+ {
88
+ "type": "SYMBOL",
89
+ "name": "sep_int"
90
+ },
91
+ {
92
+ "type": "SYMBOL",
93
+ "name": "sep_float"
94
+ }
95
+ ]
96
+ }
97
+ },
98
+ {
99
+ "type": "SYMBOL",
100
+ "name": "_marker_ws"
101
+ },
102
+ {
103
+ "type": "FIELD",
104
+ "name": "value",
105
+ "content": {
106
+ "type": "CHOICE",
107
+ "members": [
108
+ {
109
+ "type": "SYMBOL",
110
+ "name": "empty_value"
111
+ },
112
+ {
113
+ "type": "SYMBOL",
114
+ "name": "scalar"
115
+ }
116
+ ]
117
+ }
118
+ }
119
+ ]
120
+ },
121
+ {
122
+ "type": "SEQ",
123
+ "members": [
124
+ {
125
+ "type": "FIELD",
126
+ "name": "key",
127
+ "content": {
128
+ "type": "SYMBOL",
129
+ "name": "key"
130
+ }
131
+ },
132
+ {
133
+ "type": "FIELD",
134
+ "name": "separator",
135
+ "content": {
136
+ "type": "SYMBOL",
137
+ "name": "sep_string"
138
+ }
139
+ },
140
+ {
141
+ "type": "SYMBOL",
142
+ "name": "_marker_ws"
143
+ },
144
+ {
145
+ "type": "CHOICE",
146
+ "members": [
147
+ {
148
+ "type": "FIELD",
149
+ "name": "value",
150
+ "content": {
151
+ "type": "SYMBOL",
152
+ "name": "empty_value"
153
+ }
154
+ },
155
+ {
156
+ "type": "FIELD",
157
+ "name": "value",
158
+ "content": {
159
+ "type": "SYMBOL",
160
+ "name": "_value_line"
161
+ }
162
+ }
163
+ ]
164
+ }
165
+ ]
166
+ }
167
+ ]
168
+ },
169
+ "sep_raw": {
170
+ "type": "TOKEN",
171
+ "content": {
172
+ "type": "PREC",
173
+ "value": 3,
174
+ "content": {
175
+ "type": "STRING",
176
+ "value": "::"
177
+ }
178
+ }
179
+ },
180
+ "sep_int": {
181
+ "type": "TOKEN",
182
+ "content": {
183
+ "type": "PREC",
184
+ "value": 2,
185
+ "content": {
186
+ "type": "STRING",
187
+ "value": ":i"
188
+ }
189
+ }
190
+ },
191
+ "sep_float": {
192
+ "type": "TOKEN",
193
+ "content": {
194
+ "type": "PREC",
195
+ "value": 2,
196
+ "content": {
197
+ "type": "STRING",
198
+ "value": ":f"
199
+ }
200
+ }
201
+ },
202
+ "sep_string": {
203
+ "type": "TOKEN",
204
+ "content": {
205
+ "type": "PREC",
206
+ "value": 1,
207
+ "content": {
208
+ "type": "STRING",
209
+ "value": ":"
210
+ }
211
+ }
212
+ },
213
+ "key": {
214
+ "type": "CHOICE",
215
+ "members": [
216
+ {
217
+ "type": "SYMBOL",
218
+ "name": "_key_segment"
219
+ },
220
+ {
221
+ "type": "SYMBOL",
222
+ "name": "dotted_key"
223
+ }
224
+ ]
225
+ },
226
+ "dotted_key": {
227
+ "type": "PREC_LEFT",
228
+ "value": 0,
229
+ "content": {
230
+ "type": "SEQ",
231
+ "members": [
232
+ {
233
+ "type": "SYMBOL",
234
+ "name": "_key_segment"
235
+ },
236
+ {
237
+ "type": "REPEAT1",
238
+ "content": {
239
+ "type": "SEQ",
240
+ "members": [
241
+ {
242
+ "type": "STRING",
243
+ "value": "."
244
+ },
245
+ {
246
+ "type": "SYMBOL",
247
+ "name": "_key_segment"
248
+ }
249
+ ]
250
+ }
251
+ }
252
+ ]
253
+ }
254
+ },
255
+ "_key_segment": {
256
+ "type": "PATTERN",
257
+ "value": "[^\\s\\[\\]\\{\\}:#.\\r\\n]+"
258
+ },
259
+ "_value_line": {
260
+ "type": "CHOICE",
261
+ "members": [
262
+ {
263
+ "type": "SYMBOL",
264
+ "name": "compound_object"
265
+ },
266
+ {
267
+ "type": "SYMBOL",
268
+ "name": "compound_array"
269
+ },
270
+ {
271
+ "type": "SYMBOL",
272
+ "name": "multiline_stripped"
273
+ },
274
+ {
275
+ "type": "SYMBOL",
276
+ "name": "multiline_verbatim"
277
+ },
278
+ {
279
+ "type": "SYMBOL",
280
+ "name": "empty_object"
281
+ },
282
+ {
283
+ "type": "SYMBOL",
284
+ "name": "empty_array"
285
+ },
286
+ {
287
+ "type": "SYMBOL",
288
+ "name": "empty_paren"
289
+ },
290
+ {
291
+ "type": "SYMBOL",
292
+ "name": "empty_double_paren"
293
+ },
294
+ {
295
+ "type": "SYMBOL",
296
+ "name": "keyword"
297
+ },
298
+ {
299
+ "type": "SYMBOL",
300
+ "name": "scalar"
301
+ }
302
+ ]
303
+ },
304
+ "empty_value": {
305
+ "type": "SYMBOL",
306
+ "name": "_newline"
307
+ },
308
+ "empty_object": {
309
+ "type": "SEQ",
310
+ "members": [
311
+ {
312
+ "type": "TOKEN",
313
+ "content": {
314
+ "type": "PREC",
315
+ "value": 5,
316
+ "content": {
317
+ "type": "STRING",
318
+ "value": "{}"
319
+ }
320
+ }
321
+ },
322
+ {
323
+ "type": "SYMBOL",
324
+ "name": "_newline"
325
+ }
326
+ ]
327
+ },
328
+ "empty_array": {
329
+ "type": "SEQ",
330
+ "members": [
331
+ {
332
+ "type": "TOKEN",
333
+ "content": {
334
+ "type": "PREC",
335
+ "value": 5,
336
+ "content": {
337
+ "type": "STRING",
338
+ "value": "[]"
339
+ }
340
+ }
341
+ },
342
+ {
343
+ "type": "SYMBOL",
344
+ "name": "_newline"
345
+ }
346
+ ]
347
+ },
348
+ "empty_paren": {
349
+ "type": "SEQ",
350
+ "members": [
351
+ {
352
+ "type": "TOKEN",
353
+ "content": {
354
+ "type": "PREC",
355
+ "value": 5,
356
+ "content": {
357
+ "type": "STRING",
358
+ "value": "()"
359
+ }
360
+ }
361
+ },
362
+ {
363
+ "type": "SYMBOL",
364
+ "name": "_newline"
365
+ }
366
+ ]
367
+ },
368
+ "empty_double_paren": {
369
+ "type": "SEQ",
370
+ "members": [
371
+ {
372
+ "type": "TOKEN",
373
+ "content": {
374
+ "type": "PREC",
375
+ "value": 5,
376
+ "content": {
377
+ "type": "STRING",
378
+ "value": "(())"
379
+ }
380
+ }
381
+ },
382
+ {
383
+ "type": "SYMBOL",
384
+ "name": "_newline"
385
+ }
386
+ ]
387
+ },
388
+ "open_brace": {
389
+ "type": "TOKEN",
390
+ "content": {
391
+ "type": "PREC",
392
+ "value": 4,
393
+ "content": {
394
+ "type": "PATTERN",
395
+ "value": "\\{[ \\t]*\\r?\\n"
396
+ }
397
+ }
398
+ },
399
+ "close_brace": {
400
+ "type": "SEQ",
401
+ "members": [
402
+ {
403
+ "type": "TOKEN",
404
+ "content": {
405
+ "type": "PREC",
406
+ "value": 4,
407
+ "content": {
408
+ "type": "STRING",
409
+ "value": "}"
410
+ }
411
+ }
412
+ },
413
+ {
414
+ "type": "SYMBOL",
415
+ "name": "_strict_eol"
416
+ }
417
+ ]
418
+ },
419
+ "open_bracket": {
420
+ "type": "TOKEN",
421
+ "content": {
422
+ "type": "PREC",
423
+ "value": 4,
424
+ "content": {
425
+ "type": "PATTERN",
426
+ "value": "\\[[ \\t]*\\r?\\n"
427
+ }
428
+ }
429
+ },
430
+ "close_bracket": {
431
+ "type": "SEQ",
432
+ "members": [
433
+ {
434
+ "type": "TOKEN",
435
+ "content": {
436
+ "type": "PREC",
437
+ "value": 4,
438
+ "content": {
439
+ "type": "STRING",
440
+ "value": "]"
441
+ }
442
+ }
443
+ },
444
+ {
445
+ "type": "SYMBOL",
446
+ "name": "_strict_eol"
447
+ }
448
+ ]
449
+ },
450
+ "open_paren": {
451
+ "type": "TOKEN",
452
+ "content": {
453
+ "type": "PREC",
454
+ "value": 4,
455
+ "content": {
456
+ "type": "PATTERN",
457
+ "value": "\\([ \\t]*\\r?\\n"
458
+ }
459
+ }
460
+ },
461
+ "open_dparen": {
462
+ "type": "TOKEN",
463
+ "content": {
464
+ "type": "PREC",
465
+ "value": 5,
466
+ "content": {
467
+ "type": "PATTERN",
468
+ "value": "\\(\\([ \\t]*\\r?\\n"
469
+ }
470
+ }
471
+ },
472
+ "close_paren": {
473
+ "type": "SYMBOL",
474
+ "name": "_stripped_close"
475
+ },
476
+ "close_dparen": {
477
+ "type": "SYMBOL",
478
+ "name": "_verbatim_close"
479
+ },
480
+ "compound_object": {
481
+ "type": "SEQ",
482
+ "members": [
483
+ {
484
+ "type": "SYMBOL",
485
+ "name": "open_brace"
486
+ },
487
+ {
488
+ "type": "REPEAT",
489
+ "content": {
490
+ "type": "CHOICE",
491
+ "members": [
492
+ {
493
+ "type": "SYMBOL",
494
+ "name": "comment"
495
+ },
496
+ {
497
+ "type": "SYMBOL",
498
+ "name": "blank_line"
499
+ },
500
+ {
501
+ "type": "SYMBOL",
502
+ "name": "object_pair"
503
+ }
504
+ ]
505
+ }
506
+ },
507
+ {
508
+ "type": "SYMBOL",
509
+ "name": "close_brace"
510
+ }
511
+ ]
512
+ },
513
+ "compound_array": {
514
+ "type": "SEQ",
515
+ "members": [
516
+ {
517
+ "type": "SYMBOL",
518
+ "name": "open_bracket"
519
+ },
520
+ {
521
+ "type": "REPEAT",
522
+ "content": {
523
+ "type": "CHOICE",
524
+ "members": [
525
+ {
526
+ "type": "SYMBOL",
527
+ "name": "comment"
528
+ },
529
+ {
530
+ "type": "SYMBOL",
531
+ "name": "blank_line"
532
+ },
533
+ {
534
+ "type": "SYMBOL",
535
+ "name": "array_item"
536
+ }
537
+ ]
538
+ }
539
+ },
540
+ {
541
+ "type": "SYMBOL",
542
+ "name": "close_bracket"
543
+ }
544
+ ]
545
+ },
546
+ "array_item": {
547
+ "type": "CHOICE",
548
+ "members": [
549
+ {
550
+ "type": "SEQ",
551
+ "members": [
552
+ {
553
+ "type": "FIELD",
554
+ "name": "marker",
555
+ "content": {
556
+ "type": "SYMBOL",
557
+ "name": "sep_raw"
558
+ }
559
+ },
560
+ {
561
+ "type": "SYMBOL",
562
+ "name": "_marker_ws"
563
+ },
564
+ {
565
+ "type": "FIELD",
566
+ "name": "value",
567
+ "content": {
568
+ "type": "CHOICE",
569
+ "members": [
570
+ {
571
+ "type": "SYMBOL",
572
+ "name": "empty_value"
573
+ },
574
+ {
575
+ "type": "SYMBOL",
576
+ "name": "scalar"
577
+ }
578
+ ]
579
+ }
580
+ }
581
+ ]
582
+ },
583
+ {
584
+ "type": "SEQ",
585
+ "members": [
586
+ {
587
+ "type": "FIELD",
588
+ "name": "marker",
589
+ "content": {
590
+ "type": "SYMBOL",
591
+ "name": "sep_int"
592
+ }
593
+ },
594
+ {
595
+ "type": "SYMBOL",
596
+ "name": "_marker_ws"
597
+ },
598
+ {
599
+ "type": "FIELD",
600
+ "name": "value",
601
+ "content": {
602
+ "type": "CHOICE",
603
+ "members": [
604
+ {
605
+ "type": "SYMBOL",
606
+ "name": "empty_value"
607
+ },
608
+ {
609
+ "type": "SYMBOL",
610
+ "name": "scalar"
611
+ }
612
+ ]
613
+ }
614
+ }
615
+ ]
616
+ },
617
+ {
618
+ "type": "SEQ",
619
+ "members": [
620
+ {
621
+ "type": "FIELD",
622
+ "name": "marker",
623
+ "content": {
624
+ "type": "SYMBOL",
625
+ "name": "sep_float"
626
+ }
627
+ },
628
+ {
629
+ "type": "SYMBOL",
630
+ "name": "_marker_ws"
631
+ },
632
+ {
633
+ "type": "FIELD",
634
+ "name": "value",
635
+ "content": {
636
+ "type": "CHOICE",
637
+ "members": [
638
+ {
639
+ "type": "SYMBOL",
640
+ "name": "empty_value"
641
+ },
642
+ {
643
+ "type": "SYMBOL",
644
+ "name": "scalar"
645
+ }
646
+ ]
647
+ }
648
+ }
649
+ ]
650
+ },
651
+ {
652
+ "type": "FIELD",
653
+ "name": "value",
654
+ "content": {
655
+ "type": "SYMBOL",
656
+ "name": "_value_line"
657
+ }
658
+ }
659
+ ]
660
+ },
661
+ "multiline_stripped": {
662
+ "type": "SEQ",
663
+ "members": [
664
+ {
665
+ "type": "SYMBOL",
666
+ "name": "open_paren"
667
+ },
668
+ {
669
+ "type": "REPEAT",
670
+ "content": {
671
+ "type": "SYMBOL",
672
+ "name": "multiline_content_line"
673
+ }
674
+ },
675
+ {
676
+ "type": "SYMBOL",
677
+ "name": "close_paren"
678
+ }
679
+ ]
680
+ },
681
+ "multiline_verbatim": {
682
+ "type": "SEQ",
683
+ "members": [
684
+ {
685
+ "type": "SYMBOL",
686
+ "name": "open_dparen"
687
+ },
688
+ {
689
+ "type": "REPEAT",
690
+ "content": {
691
+ "type": "SYMBOL",
692
+ "name": "multiline_content_line"
693
+ }
694
+ },
695
+ {
696
+ "type": "SYMBOL",
697
+ "name": "close_dparen"
698
+ }
699
+ ]
700
+ },
701
+ "multiline_content_line": {
702
+ "type": "TOKEN",
703
+ "content": {
704
+ "type": "PREC",
705
+ "value": -1,
706
+ "content": {
707
+ "type": "PATTERN",
708
+ "value": "[^\\r\\n]*\\r?\\n"
709
+ }
710
+ }
711
+ },
712
+ "scalar": {
713
+ "type": "SEQ",
714
+ "members": [
715
+ {
716
+ "type": "SYMBOL",
717
+ "name": "_scalar_text"
718
+ },
719
+ {
720
+ "type": "SYMBOL",
721
+ "name": "_newline"
722
+ }
723
+ ]
724
+ },
725
+ "_scalar_text": {
726
+ "type": "PATTERN",
727
+ "value": "[^\\s\\r\\n][^\\r\\n]*"
728
+ },
729
+ "keyword": {
730
+ "type": "SEQ",
731
+ "members": [
732
+ {
733
+ "type": "CHOICE",
734
+ "members": [
735
+ {
736
+ "type": "SYMBOL",
737
+ "name": "kw_null"
738
+ },
739
+ {
740
+ "type": "SYMBOL",
741
+ "name": "kw_true"
742
+ },
743
+ {
744
+ "type": "SYMBOL",
745
+ "name": "kw_false"
746
+ }
747
+ ]
748
+ },
749
+ {
750
+ "type": "SYMBOL",
751
+ "name": "_newline"
752
+ }
753
+ ]
754
+ },
755
+ "kw_null": {
756
+ "type": "TOKEN",
757
+ "content": {
758
+ "type": "PREC",
759
+ "value": 3,
760
+ "content": {
761
+ "type": "STRING",
762
+ "value": "null"
763
+ }
764
+ }
765
+ },
766
+ "kw_true": {
767
+ "type": "TOKEN",
768
+ "content": {
769
+ "type": "PREC",
770
+ "value": 3,
771
+ "content": {
772
+ "type": "STRING",
773
+ "value": "true"
774
+ }
775
+ }
776
+ },
777
+ "kw_false": {
778
+ "type": "TOKEN",
779
+ "content": {
780
+ "type": "PREC",
781
+ "value": 3,
782
+ "content": {
783
+ "type": "STRING",
784
+ "value": "false"
785
+ }
786
+ }
787
+ }
788
+ },
789
+ "extras": [
790
+ {
791
+ "type": "PATTERN",
792
+ "value": "[ \\t]+"
793
+ }
794
+ ],
795
+ "conflicts": [],
796
+ "precedences": [],
797
+ "externals": [
798
+ {
799
+ "type": "SYMBOL",
800
+ "name": "_marker_ws"
801
+ },
802
+ {
803
+ "type": "SYMBOL",
804
+ "name": "_strict_eol"
805
+ },
806
+ {
807
+ "type": "SYMBOL",
808
+ "name": "_stripped_close"
809
+ },
810
+ {
811
+ "type": "SYMBOL",
812
+ "name": "_verbatim_close"
813
+ }
814
+ ],
815
+ "inline": [],
816
+ "supertypes": [],
817
+ "reserved": {}
818
+ }