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