tree-sitter-ktav 0.3.0 → 0.5.0

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.
package/src/grammar.json CHANGED
@@ -46,7 +46,7 @@
46
46
  "value": 1,
47
47
  "content": {
48
48
  "type": "PATTERN",
49
- "value": "#[^\\r\\n]*\\r?\\n"
49
+ "value": "##[^\\r\\n]*\\r?\\n"
50
50
  }
51
51
  }
52
52
  },
@@ -68,21 +68,8 @@
68
68
  "type": "FIELD",
69
69
  "name": "separator",
70
70
  "content": {
71
- "type": "CHOICE",
72
- "members": [
73
- {
74
- "type": "SYMBOL",
75
- "name": "sep_raw"
76
- },
77
- {
78
- "type": "SYMBOL",
79
- "name": "sep_int"
80
- },
81
- {
82
- "type": "SYMBOL",
83
- "name": "sep_float"
84
- }
85
- ]
71
+ "type": "SYMBOL",
72
+ "name": "sep_raw"
86
73
  }
87
74
  },
88
75
  {
@@ -101,7 +88,7 @@
101
88
  },
102
89
  {
103
90
  "type": "SYMBOL",
104
- "name": "scalar"
91
+ "name": "raw_scalar"
105
92
  }
106
93
  ]
107
94
  }
@@ -167,28 +154,6 @@
167
154
  }
168
155
  }
169
156
  },
170
- "sep_int": {
171
- "type": "TOKEN",
172
- "content": {
173
- "type": "PREC",
174
- "value": 2,
175
- "content": {
176
- "type": "STRING",
177
- "value": ":i"
178
- }
179
- }
180
- },
181
- "sep_float": {
182
- "type": "TOKEN",
183
- "content": {
184
- "type": "PREC",
185
- "value": 2,
186
- "content": {
187
- "type": "STRING",
188
- "value": ":f"
189
- }
190
- }
191
- },
192
157
  "sep_string": {
193
158
  "type": "TOKEN",
194
159
  "content": {
@@ -205,7 +170,7 @@
205
170
  "members": [
206
171
  {
207
172
  "type": "SYMBOL",
208
- "name": "_key_segment"
173
+ "name": "_spaced_key"
209
174
  },
210
175
  {
211
176
  "type": "SYMBOL",
@@ -213,6 +178,17 @@
213
178
  }
214
179
  ]
215
180
  },
181
+ "_spaced_key": {
182
+ "type": "PREC_LEFT",
183
+ "value": 0,
184
+ "content": {
185
+ "type": "REPEAT1",
186
+ "content": {
187
+ "type": "SYMBOL",
188
+ "name": "_key_segment"
189
+ }
190
+ }
191
+ },
216
192
  "dotted_key": {
217
193
  "type": "PREC_LEFT",
218
194
  "value": 0,
@@ -244,7 +220,7 @@
244
220
  },
245
221
  "_key_segment": {
246
222
  "type": "PATTERN",
247
- "value": "[^\\s\\[\\]\\{\\}:#.\\r\\n]+"
223
+ "value": "[^\\s\\[\\]\\{\\}\\(\\):#,.\\r\\n]+"
248
224
  },
249
225
  "_value_line": {
250
226
  "type": "CHOICE",
@@ -281,10 +257,26 @@
281
257
  "type": "SYMBOL",
282
258
  "name": "empty_double_paren"
283
259
  },
260
+ {
261
+ "type": "SYMBOL",
262
+ "name": "inline_object"
263
+ },
264
+ {
265
+ "type": "SYMBOL",
266
+ "name": "inline_array"
267
+ },
284
268
  {
285
269
  "type": "SYMBOL",
286
270
  "name": "keyword"
287
271
  },
272
+ {
273
+ "type": "SYMBOL",
274
+ "name": "integer"
275
+ },
276
+ {
277
+ "type": "SYMBOL",
278
+ "name": "float"
279
+ },
288
280
  {
289
281
  "type": "SYMBOL",
290
282
  "name": "scalar"
@@ -533,158 +525,342 @@
533
525
  }
534
526
  ]
535
527
  },
536
- "array_item": {
537
- "type": "CHOICE",
528
+ "inline_object": {
529
+ "type": "SEQ",
538
530
  "members": [
539
531
  {
540
- "type": "SEQ",
532
+ "type": "STRING",
533
+ "value": "{"
534
+ },
535
+ {
536
+ "type": "CHOICE",
541
537
  "members": [
542
- {
543
- "type": "FIELD",
544
- "name": "marker",
545
- "content": {
546
- "type": "SYMBOL",
547
- "name": "sep_raw"
548
- }
549
- },
550
538
  {
551
539
  "type": "SYMBOL",
552
- "name": "_marker_ws"
540
+ "name": "_inline_pair_list"
553
541
  },
554
542
  {
555
- "type": "FIELD",
556
- "name": "value",
557
- "content": {
558
- "type": "CHOICE",
559
- "members": [
560
- {
561
- "type": "SYMBOL",
562
- "name": "empty_value"
563
- },
564
- {
565
- "type": "SYMBOL",
566
- "name": "scalar"
567
- }
568
- ]
569
- }
543
+ "type": "BLANK"
570
544
  }
571
545
  ]
572
546
  },
573
547
  {
574
- "type": "SEQ",
548
+ "type": "STRING",
549
+ "value": "}"
550
+ },
551
+ {
552
+ "type": "SYMBOL",
553
+ "name": "_newline"
554
+ }
555
+ ]
556
+ },
557
+ "inline_array": {
558
+ "type": "SEQ",
559
+ "members": [
560
+ {
561
+ "type": "STRING",
562
+ "value": "["
563
+ },
564
+ {
565
+ "type": "CHOICE",
575
566
  "members": [
576
567
  {
577
- "type": "FIELD",
578
- "name": "marker",
579
- "content": {
568
+ "type": "SYMBOL",
569
+ "name": "_inline_item_list"
570
+ },
571
+ {
572
+ "type": "BLANK"
573
+ }
574
+ ]
575
+ },
576
+ {
577
+ "type": "STRING",
578
+ "value": "]"
579
+ },
580
+ {
581
+ "type": "SYMBOL",
582
+ "name": "_newline"
583
+ }
584
+ ]
585
+ },
586
+ "_inline_pair_list": {
587
+ "type": "SEQ",
588
+ "members": [
589
+ {
590
+ "type": "SYMBOL",
591
+ "name": "inline_pair"
592
+ },
593
+ {
594
+ "type": "REPEAT",
595
+ "content": {
596
+ "type": "SEQ",
597
+ "members": [
598
+ {
599
+ "type": "STRING",
600
+ "value": ","
601
+ },
602
+ {
580
603
  "type": "SYMBOL",
581
- "name": "sep_int"
604
+ "name": "inline_pair"
582
605
  }
583
- },
606
+ ]
607
+ }
608
+ },
609
+ {
610
+ "type": "CHOICE",
611
+ "members": [
584
612
  {
585
- "type": "SYMBOL",
586
- "name": "_marker_ws"
613
+ "type": "STRING",
614
+ "value": ","
587
615
  },
588
616
  {
589
- "type": "FIELD",
590
- "name": "value",
591
- "content": {
592
- "type": "CHOICE",
593
- "members": [
594
- {
595
- "type": "SYMBOL",
596
- "name": "empty_value"
597
- },
598
- {
599
- "type": "SYMBOL",
600
- "name": "scalar"
601
- }
602
- ]
603
- }
617
+ "type": "BLANK"
604
618
  }
605
619
  ]
620
+ }
621
+ ]
622
+ },
623
+ "inline_pair": {
624
+ "type": "SEQ",
625
+ "members": [
626
+ {
627
+ "type": "FIELD",
628
+ "name": "key",
629
+ "content": {
630
+ "type": "SYMBOL",
631
+ "name": "key"
632
+ }
606
633
  },
607
634
  {
608
- "type": "SEQ",
635
+ "type": "FIELD",
636
+ "name": "separator",
637
+ "content": {
638
+ "type": "CHOICE",
639
+ "members": [
640
+ {
641
+ "type": "SYMBOL",
642
+ "name": "sep_raw"
643
+ },
644
+ {
645
+ "type": "SYMBOL",
646
+ "name": "sep_string"
647
+ }
648
+ ]
649
+ }
650
+ },
651
+ {
652
+ "type": "CHOICE",
609
653
  "members": [
610
654
  {
611
655
  "type": "FIELD",
612
- "name": "marker",
656
+ "name": "value",
613
657
  "content": {
614
658
  "type": "SYMBOL",
615
- "name": "sep_float"
659
+ "name": "inline_value"
616
660
  }
617
661
  },
618
662
  {
619
- "type": "SYMBOL",
620
- "name": "_marker_ws"
621
- },
622
- {
623
- "type": "FIELD",
624
- "name": "value",
625
- "content": {
626
- "type": "CHOICE",
627
- "members": [
628
- {
629
- "type": "SYMBOL",
630
- "name": "empty_value"
631
- },
632
- {
633
- "type": "SYMBOL",
634
- "name": "scalar"
635
- }
636
- ]
637
- }
663
+ "type": "BLANK"
638
664
  }
639
665
  ]
666
+ }
667
+ ]
668
+ },
669
+ "_inline_item_list": {
670
+ "type": "SEQ",
671
+ "members": [
672
+ {
673
+ "type": "SYMBOL",
674
+ "name": "inline_value"
640
675
  },
641
676
  {
642
- "type": "FIELD",
643
- "name": "value",
677
+ "type": "REPEAT",
644
678
  "content": {
645
- "type": "SYMBOL",
646
- "name": "_value_line"
679
+ "type": "SEQ",
680
+ "members": [
681
+ {
682
+ "type": "STRING",
683
+ "value": ","
684
+ },
685
+ {
686
+ "type": "SYMBOL",
687
+ "name": "inline_value"
688
+ }
689
+ ]
647
690
  }
691
+ },
692
+ {
693
+ "type": "CHOICE",
694
+ "members": [
695
+ {
696
+ "type": "STRING",
697
+ "value": ","
698
+ },
699
+ {
700
+ "type": "BLANK"
701
+ }
702
+ ]
648
703
  }
649
704
  ]
650
705
  },
651
- "top_array_item": {
706
+ "inline_value": {
652
707
  "type": "CHOICE",
653
708
  "members": [
654
709
  {
655
- "type": "SEQ",
710
+ "type": "SYMBOL",
711
+ "name": "nested_inline_object"
712
+ },
713
+ {
714
+ "type": "SYMBOL",
715
+ "name": "nested_inline_array"
716
+ },
717
+ {
718
+ "type": "SYMBOL",
719
+ "name": "inline_scalar"
720
+ }
721
+ ]
722
+ },
723
+ "nested_inline_object": {
724
+ "type": "SEQ",
725
+ "members": [
726
+ {
727
+ "type": "STRING",
728
+ "value": "{"
729
+ },
730
+ {
731
+ "type": "CHOICE",
656
732
  "members": [
657
733
  {
658
- "type": "FIELD",
659
- "name": "marker",
660
- "content": {
661
- "type": "SYMBOL",
662
- "name": "sep_raw"
663
- }
734
+ "type": "SYMBOL",
735
+ "name": "_inline_pair_list"
664
736
  },
737
+ {
738
+ "type": "BLANK"
739
+ }
740
+ ]
741
+ },
742
+ {
743
+ "type": "STRING",
744
+ "value": "}"
745
+ }
746
+ ]
747
+ },
748
+ "nested_inline_array": {
749
+ "type": "SEQ",
750
+ "members": [
751
+ {
752
+ "type": "STRING",
753
+ "value": "["
754
+ },
755
+ {
756
+ "type": "CHOICE",
757
+ "members": [
665
758
  {
666
759
  "type": "SYMBOL",
667
- "name": "_marker_ws"
760
+ "name": "_inline_item_list"
668
761
  },
669
762
  {
670
- "type": "FIELD",
671
- "name": "value",
672
- "content": {
673
- "type": "CHOICE",
674
- "members": [
675
- {
676
- "type": "SYMBOL",
677
- "name": "empty_value"
678
- },
679
- {
680
- "type": "SYMBOL",
681
- "name": "scalar"
682
- }
683
- ]
684
- }
763
+ "type": "BLANK"
764
+ }
765
+ ]
766
+ },
767
+ {
768
+ "type": "STRING",
769
+ "value": "]"
770
+ }
771
+ ]
772
+ },
773
+ "inline_scalar": {
774
+ "type": "SEQ",
775
+ "members": [
776
+ {
777
+ "type": "CHOICE",
778
+ "members": [
779
+ {
780
+ "type": "SYMBOL",
781
+ "name": "escape_sequence"
782
+ },
783
+ {
784
+ "type": "SYMBOL",
785
+ "name": "_inline_scalar_head"
685
786
  }
686
787
  ]
687
788
  },
789
+ {
790
+ "type": "REPEAT",
791
+ "content": {
792
+ "type": "CHOICE",
793
+ "members": [
794
+ {
795
+ "type": "SYMBOL",
796
+ "name": "escape_sequence"
797
+ },
798
+ {
799
+ "type": "SYMBOL",
800
+ "name": "_inline_scalar_text"
801
+ }
802
+ ]
803
+ }
804
+ }
805
+ ]
806
+ },
807
+ "escape_sequence": {
808
+ "type": "TOKEN",
809
+ "content": {
810
+ "type": "CHOICE",
811
+ "members": [
812
+ {
813
+ "type": "STRING",
814
+ "value": "\\\\"
815
+ },
816
+ {
817
+ "type": "STRING",
818
+ "value": "\\,"
819
+ },
820
+ {
821
+ "type": "STRING",
822
+ "value": "\\}"
823
+ },
824
+ {
825
+ "type": "STRING",
826
+ "value": "\\]"
827
+ },
828
+ {
829
+ "type": "STRING",
830
+ "value": "\\{"
831
+ },
832
+ {
833
+ "type": "STRING",
834
+ "value": "\\["
835
+ },
836
+ {
837
+ "type": "STRING",
838
+ "value": "\\n"
839
+ },
840
+ {
841
+ "type": "STRING",
842
+ "value": "\\r"
843
+ }
844
+ ]
845
+ }
846
+ },
847
+ "_inline_scalar_head": {
848
+ "type": "TOKEN",
849
+ "content": {
850
+ "type": "PATTERN",
851
+ "value": "[^\\s\\\\,\\{\\[\\}\\]\\r\\n][^\\\\,\\}\\]\\r\\n]*"
852
+ }
853
+ },
854
+ "_inline_scalar_text": {
855
+ "type": "TOKEN",
856
+ "content": {
857
+ "type": "PATTERN",
858
+ "value": "[^\\\\,\\}\\]\\r\\n]+"
859
+ }
860
+ },
861
+ "array_item": {
862
+ "type": "CHOICE",
863
+ "members": [
688
864
  {
689
865
  "type": "SEQ",
690
866
  "members": [
@@ -693,7 +869,7 @@
693
869
  "name": "marker",
694
870
  "content": {
695
871
  "type": "SYMBOL",
696
- "name": "sep_int"
872
+ "name": "sep_raw"
697
873
  }
698
874
  },
699
875
  {
@@ -712,13 +888,26 @@
712
888
  },
713
889
  {
714
890
  "type": "SYMBOL",
715
- "name": "scalar"
891
+ "name": "raw_scalar"
716
892
  }
717
893
  ]
718
894
  }
719
895
  }
720
896
  ]
721
897
  },
898
+ {
899
+ "type": "FIELD",
900
+ "name": "value",
901
+ "content": {
902
+ "type": "SYMBOL",
903
+ "name": "_value_line"
904
+ }
905
+ }
906
+ ]
907
+ },
908
+ "top_array_item": {
909
+ "type": "CHOICE",
910
+ "members": [
722
911
  {
723
912
  "type": "SEQ",
724
913
  "members": [
@@ -727,7 +916,7 @@
727
916
  "name": "marker",
728
917
  "content": {
729
918
  "type": "SYMBOL",
730
- "name": "sep_float"
919
+ "name": "sep_raw"
731
920
  }
732
921
  },
733
922
  {
@@ -746,7 +935,7 @@
746
935
  },
747
936
  {
748
937
  "type": "SYMBOL",
749
- "name": "scalar"
938
+ "name": "raw_scalar"
750
939
  }
751
940
  ]
752
941
  }
@@ -817,6 +1006,22 @@
817
1006
  "name": "empty_double_paren"
818
1007
  }
819
1008
  },
1009
+ {
1010
+ "type": "FIELD",
1011
+ "name": "value",
1012
+ "content": {
1013
+ "type": "SYMBOL",
1014
+ "name": "inline_object"
1015
+ }
1016
+ },
1017
+ {
1018
+ "type": "FIELD",
1019
+ "name": "value",
1020
+ "content": {
1021
+ "type": "SYMBOL",
1022
+ "name": "inline_array"
1023
+ }
1024
+ },
820
1025
  {
821
1026
  "type": "FIELD",
822
1027
  "name": "value",
@@ -825,6 +1030,22 @@
825
1030
  "name": "keyword"
826
1031
  }
827
1032
  },
1033
+ {
1034
+ "type": "FIELD",
1035
+ "name": "value",
1036
+ "content": {
1037
+ "type": "SYMBOL",
1038
+ "name": "integer"
1039
+ }
1040
+ },
1041
+ {
1042
+ "type": "FIELD",
1043
+ "name": "value",
1044
+ "content": {
1045
+ "type": "SYMBOL",
1046
+ "name": "float"
1047
+ }
1048
+ },
828
1049
  {
829
1050
  "type": "FIELD",
830
1051
  "name": "value",
@@ -843,7 +1064,7 @@
843
1064
  "type": "TOKEN",
844
1065
  "content": {
845
1066
  "type": "PATTERN",
846
- "value": "[^\\s:\\r\\n][^:\\r\\n]*\\r?\\n"
1067
+ "value": "[^\\s:\\{\\[\\(\\r\\n][^:\\r\\n]*\\r?\\n"
847
1068
  }
848
1069
  },
849
1070
  "multiline_stripped": {
@@ -910,10 +1131,49 @@
910
1131
  }
911
1132
  ]
912
1133
  },
913
- "_scalar_text": {
1134
+ "raw_scalar": {
1135
+ "type": "SEQ",
1136
+ "members": [
1137
+ {
1138
+ "type": "SYMBOL",
1139
+ "name": "_raw_scalar_text"
1140
+ },
1141
+ {
1142
+ "type": "SYMBOL",
1143
+ "name": "_newline"
1144
+ }
1145
+ ]
1146
+ },
1147
+ "_raw_scalar_text": {
914
1148
  "type": "PATTERN",
915
1149
  "value": "[^\\s\\r\\n][^\\r\\n]*"
916
1150
  },
1151
+ "_scalar_text": {
1152
+ "type": "PATTERN",
1153
+ "value": "[^\\s\\{\\[\\(\\r\\n][^\\r\\n]*"
1154
+ },
1155
+ "integer": {
1156
+ "type": "TOKEN",
1157
+ "content": {
1158
+ "type": "PREC",
1159
+ "value": 2,
1160
+ "content": {
1161
+ "type": "PATTERN",
1162
+ "value": "[+-]?(0x[0-9a-fA-F]([_]?[0-9a-fA-F])*|0o[0-7]([_]?[0-7])*|0b[01]([_]?[01])*|[0-9]([_]?[0-9])*)[ \\t]*\\r?\\n"
1163
+ }
1164
+ }
1165
+ },
1166
+ "float": {
1167
+ "type": "TOKEN",
1168
+ "content": {
1169
+ "type": "PREC",
1170
+ "value": 3,
1171
+ "content": {
1172
+ "type": "PATTERN",
1173
+ "value": "([+-]?[0-9]([_]?[0-9])*\\.[0-9]([_]?[0-9])*([eE][+-]?[0-9]([_]?[0-9])*)?|[+-]?[0-9]([_]?[0-9])*[eE][+-]?[0-9]([_]?[0-9])*)[ \\t]*\\r?\\n"
1174
+ }
1175
+ }
1176
+ },
917
1177
  "keyword": {
918
1178
  "type": "SEQ",
919
1179
  "members": [