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