tree-sitter-ktav 0.3.0 → 0.6.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\\\\]|\\\\[\\\\,\\}\\]\\{\\[nr.:])+"
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,350 @@
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"
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": [
758
+ {
759
+ "type": "SYMBOL",
760
+ "name": "_inline_item_list"
664
761
  },
762
+ {
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": [
665
779
  {
666
780
  "type": "SYMBOL",
667
- "name": "_marker_ws"
781
+ "name": "escape_sequence"
668
782
  },
669
783
  {
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
- }
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
+ "type": "STRING",
846
+ "value": "\\."
847
+ },
848
+ {
849
+ "type": "STRING",
850
+ "value": "\\:"
851
+ }
852
+ ]
853
+ }
854
+ },
855
+ "_inline_scalar_head": {
856
+ "type": "TOKEN",
857
+ "content": {
858
+ "type": "PATTERN",
859
+ "value": "[^\\s\\\\,\\{\\[\\}\\]\\r\\n][^\\\\,\\}\\]\\r\\n]*"
860
+ }
861
+ },
862
+ "_inline_scalar_text": {
863
+ "type": "TOKEN",
864
+ "content": {
865
+ "type": "PATTERN",
866
+ "value": "[^\\\\,\\}\\]\\r\\n]+"
867
+ }
868
+ },
869
+ "array_item": {
870
+ "type": "CHOICE",
871
+ "members": [
688
872
  {
689
873
  "type": "SEQ",
690
874
  "members": [
@@ -693,7 +877,7 @@
693
877
  "name": "marker",
694
878
  "content": {
695
879
  "type": "SYMBOL",
696
- "name": "sep_int"
880
+ "name": "sep_raw"
697
881
  }
698
882
  },
699
883
  {
@@ -712,13 +896,26 @@
712
896
  },
713
897
  {
714
898
  "type": "SYMBOL",
715
- "name": "scalar"
899
+ "name": "raw_scalar"
716
900
  }
717
901
  ]
718
902
  }
719
903
  }
720
904
  ]
721
905
  },
906
+ {
907
+ "type": "FIELD",
908
+ "name": "value",
909
+ "content": {
910
+ "type": "SYMBOL",
911
+ "name": "_value_line"
912
+ }
913
+ }
914
+ ]
915
+ },
916
+ "top_array_item": {
917
+ "type": "CHOICE",
918
+ "members": [
722
919
  {
723
920
  "type": "SEQ",
724
921
  "members": [
@@ -727,7 +924,7 @@
727
924
  "name": "marker",
728
925
  "content": {
729
926
  "type": "SYMBOL",
730
- "name": "sep_float"
927
+ "name": "sep_raw"
731
928
  }
732
929
  },
733
930
  {
@@ -746,7 +943,7 @@
746
943
  },
747
944
  {
748
945
  "type": "SYMBOL",
749
- "name": "scalar"
946
+ "name": "raw_scalar"
750
947
  }
751
948
  ]
752
949
  }
@@ -817,6 +1014,22 @@
817
1014
  "name": "empty_double_paren"
818
1015
  }
819
1016
  },
1017
+ {
1018
+ "type": "FIELD",
1019
+ "name": "value",
1020
+ "content": {
1021
+ "type": "SYMBOL",
1022
+ "name": "inline_object"
1023
+ }
1024
+ },
1025
+ {
1026
+ "type": "FIELD",
1027
+ "name": "value",
1028
+ "content": {
1029
+ "type": "SYMBOL",
1030
+ "name": "inline_array"
1031
+ }
1032
+ },
820
1033
  {
821
1034
  "type": "FIELD",
822
1035
  "name": "value",
@@ -825,6 +1038,22 @@
825
1038
  "name": "keyword"
826
1039
  }
827
1040
  },
1041
+ {
1042
+ "type": "FIELD",
1043
+ "name": "value",
1044
+ "content": {
1045
+ "type": "SYMBOL",
1046
+ "name": "integer"
1047
+ }
1048
+ },
1049
+ {
1050
+ "type": "FIELD",
1051
+ "name": "value",
1052
+ "content": {
1053
+ "type": "SYMBOL",
1054
+ "name": "float"
1055
+ }
1056
+ },
828
1057
  {
829
1058
  "type": "FIELD",
830
1059
  "name": "value",
@@ -843,7 +1072,7 @@
843
1072
  "type": "TOKEN",
844
1073
  "content": {
845
1074
  "type": "PATTERN",
846
- "value": "[^\\s:\\r\\n][^:\\r\\n]*\\r?\\n"
1075
+ "value": "[^\\s:\\{\\[\\(\\r\\n][^:\\r\\n]*\\r?\\n"
847
1076
  }
848
1077
  },
849
1078
  "multiline_stripped": {
@@ -910,10 +1139,49 @@
910
1139
  }
911
1140
  ]
912
1141
  },
913
- "_scalar_text": {
1142
+ "raw_scalar": {
1143
+ "type": "SEQ",
1144
+ "members": [
1145
+ {
1146
+ "type": "SYMBOL",
1147
+ "name": "_raw_scalar_text"
1148
+ },
1149
+ {
1150
+ "type": "SYMBOL",
1151
+ "name": "_newline"
1152
+ }
1153
+ ]
1154
+ },
1155
+ "_raw_scalar_text": {
914
1156
  "type": "PATTERN",
915
1157
  "value": "[^\\s\\r\\n][^\\r\\n]*"
916
1158
  },
1159
+ "_scalar_text": {
1160
+ "type": "PATTERN",
1161
+ "value": "[^\\s\\{\\[\\(\\r\\n][^\\r\\n]*"
1162
+ },
1163
+ "integer": {
1164
+ "type": "TOKEN",
1165
+ "content": {
1166
+ "type": "PREC",
1167
+ "value": 2,
1168
+ "content": {
1169
+ "type": "PATTERN",
1170
+ "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"
1171
+ }
1172
+ }
1173
+ },
1174
+ "float": {
1175
+ "type": "TOKEN",
1176
+ "content": {
1177
+ "type": "PREC",
1178
+ "value": 3,
1179
+ "content": {
1180
+ "type": "PATTERN",
1181
+ "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"
1182
+ }
1183
+ }
1184
+ },
917
1185
  "keyword": {
918
1186
  "type": "SEQ",
919
1187
  "members": [