@gram-data/tree-sitter-gram 0.1.9 → 0.1.10
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/grammar.js +6 -6
- package/package.json +8 -8
- package/prebuilds/darwin-arm64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/darwin-x64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/linux-arm64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/linux-x64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/win32-arm64/@gram-data+tree-sitter-gram.node +0 -0
- package/prebuilds/win32-x64/@gram-data+tree-sitter-gram.node +0 -0
- package/src/grammar.json +80 -63
- package/src/node-types.json +173 -92
- package/src/parser.c +809 -788
- package/src/tree_sitter/parser.h +27 -7
package/grammar.js
CHANGED
|
@@ -11,18 +11,18 @@ module.exports = grammar({
|
|
|
11
11
|
pattern: $ => commaSep1($.pattern_element),
|
|
12
12
|
|
|
13
13
|
pattern_element: $ => seq(
|
|
14
|
-
optional(repeat($.annotation)),
|
|
15
|
-
choice(
|
|
14
|
+
field("annotations", optional(repeat($.annotation))),
|
|
15
|
+
field("element", choice(
|
|
16
16
|
$.subject,
|
|
17
17
|
$._path,
|
|
18
18
|
$._reference
|
|
19
|
-
)
|
|
19
|
+
))
|
|
20
20
|
),
|
|
21
21
|
|
|
22
22
|
// ABKNOTE -- consider the naming of the two parts of a subject
|
|
23
23
|
// attributes & association
|
|
24
24
|
// information & association
|
|
25
|
-
subject: $ => seq("[",
|
|
25
|
+
subject: $ => seq("[", field("attributes", optional($._attributes)), field("association", optional($._association)),"]"),
|
|
26
26
|
|
|
27
27
|
annotation: $ => seq(
|
|
28
28
|
"@",
|
|
@@ -37,7 +37,7 @@ module.exports = grammar({
|
|
|
37
37
|
$.node
|
|
38
38
|
),
|
|
39
39
|
|
|
40
|
-
node: $ => seq(token("("), optional($._attributes), token(")")),
|
|
40
|
+
node: $ => seq(token("("), field("attributes", optional($._attributes)), token(")")),
|
|
41
41
|
|
|
42
42
|
relationship: $ => seq(field("left", $.node), field("value", $._relationship_value), field("right", $._path)),
|
|
43
43
|
|
|
@@ -68,7 +68,7 @@ module.exports = grammar({
|
|
|
68
68
|
|
|
69
69
|
labels: $ => repeat1($.label),
|
|
70
70
|
|
|
71
|
-
label: $ => seq(field("binder", $.binder), $.symbol),
|
|
71
|
+
label: $ => seq(field("binder", $.binder), field("symbol", $.symbol)),
|
|
72
72
|
|
|
73
73
|
binder: $ => choice(token(":"), token("::")),
|
|
74
74
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gram-data/tree-sitter-gram",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "subject-oriented notation for structured data",
|
|
5
5
|
"homepage": "https://gram-data.github.io",
|
|
6
6
|
"repository": "github:gram-data/tree-sitter-gram",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"author": "",
|
|
30
30
|
"license": "ISC",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"node-
|
|
33
|
-
"node-
|
|
32
|
+
"node-addon-api": "^8.5.0",
|
|
33
|
+
"node-gyp-build": "^4.8.4"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"tree-sitter": "^0.
|
|
36
|
+
"tree-sitter": "^0.25.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
39
39
|
"tree_sitter": {
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"eslint": "^9.
|
|
45
|
-
"node-gyp": "^11.
|
|
44
|
+
"eslint": "^9.37.0",
|
|
45
|
+
"node-gyp": "^11.4.2",
|
|
46
46
|
"prebuildify": "^6.0.1",
|
|
47
|
-
"tree-sitter-cli": "^0.
|
|
47
|
+
"tree-sitter-cli": "^0.25.10"
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/grammar.json
CHANGED
|
@@ -59,36 +59,44 @@
|
|
|
59
59
|
"type": "SEQ",
|
|
60
60
|
"members": [
|
|
61
61
|
{
|
|
62
|
-
"type": "
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
62
|
+
"type": "FIELD",
|
|
63
|
+
"name": "annotations",
|
|
64
|
+
"content": {
|
|
65
|
+
"type": "CHOICE",
|
|
66
|
+
"members": [
|
|
67
|
+
{
|
|
68
|
+
"type": "REPEAT",
|
|
69
|
+
"content": {
|
|
70
|
+
"type": "SYMBOL",
|
|
71
|
+
"name": "annotation"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"type": "BLANK"
|
|
69
76
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"type": "BLANK"
|
|
73
|
-
}
|
|
74
|
-
]
|
|
77
|
+
]
|
|
78
|
+
}
|
|
75
79
|
},
|
|
76
80
|
{
|
|
77
|
-
"type": "
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
81
|
+
"type": "FIELD",
|
|
82
|
+
"name": "element",
|
|
83
|
+
"content": {
|
|
84
|
+
"type": "CHOICE",
|
|
85
|
+
"members": [
|
|
86
|
+
{
|
|
87
|
+
"type": "SYMBOL",
|
|
88
|
+
"name": "subject"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"type": "SYMBOL",
|
|
92
|
+
"name": "_path"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"type": "SYMBOL",
|
|
96
|
+
"name": "_reference"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
92
100
|
}
|
|
93
101
|
]
|
|
94
102
|
},
|
|
@@ -100,36 +108,36 @@
|
|
|
100
108
|
"value": "["
|
|
101
109
|
},
|
|
102
110
|
{
|
|
103
|
-
"type": "
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
"type": "FIELD",
|
|
112
|
+
"name": "attributes",
|
|
113
|
+
"content": {
|
|
114
|
+
"type": "CHOICE",
|
|
115
|
+
"members": [
|
|
116
|
+
{
|
|
109
117
|
"type": "SYMBOL",
|
|
110
118
|
"name": "_attributes"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"type": "BLANK"
|
|
111
122
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"type": "BLANK"
|
|
115
|
-
}
|
|
116
|
-
]
|
|
123
|
+
]
|
|
124
|
+
}
|
|
117
125
|
},
|
|
118
126
|
{
|
|
119
|
-
"type": "
|
|
120
|
-
"
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
127
|
+
"type": "FIELD",
|
|
128
|
+
"name": "association",
|
|
129
|
+
"content": {
|
|
130
|
+
"type": "CHOICE",
|
|
131
|
+
"members": [
|
|
132
|
+
{
|
|
125
133
|
"type": "SYMBOL",
|
|
126
134
|
"name": "_association"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"type": "BLANK"
|
|
127
138
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"type": "BLANK"
|
|
131
|
-
}
|
|
132
|
-
]
|
|
139
|
+
]
|
|
140
|
+
}
|
|
133
141
|
},
|
|
134
142
|
{
|
|
135
143
|
"type": "STRING",
|
|
@@ -194,16 +202,20 @@
|
|
|
194
202
|
}
|
|
195
203
|
},
|
|
196
204
|
{
|
|
197
|
-
"type": "
|
|
198
|
-
"
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
"type": "FIELD",
|
|
206
|
+
"name": "attributes",
|
|
207
|
+
"content": {
|
|
208
|
+
"type": "CHOICE",
|
|
209
|
+
"members": [
|
|
210
|
+
{
|
|
211
|
+
"type": "SYMBOL",
|
|
212
|
+
"name": "_attributes"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"type": "BLANK"
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
}
|
|
207
219
|
},
|
|
208
220
|
{
|
|
209
221
|
"type": "TOKEN",
|
|
@@ -449,8 +461,12 @@
|
|
|
449
461
|
}
|
|
450
462
|
},
|
|
451
463
|
{
|
|
452
|
-
"type": "
|
|
453
|
-
"name": "symbol"
|
|
464
|
+
"type": "FIELD",
|
|
465
|
+
"name": "symbol",
|
|
466
|
+
"content": {
|
|
467
|
+
"type": "SYMBOL",
|
|
468
|
+
"name": "symbol"
|
|
469
|
+
}
|
|
454
470
|
}
|
|
455
471
|
]
|
|
456
472
|
},
|
|
@@ -1326,5 +1342,6 @@
|
|
|
1326
1342
|
"precedences": [],
|
|
1327
1343
|
"externals": [],
|
|
1328
1344
|
"inline": [],
|
|
1329
|
-
"supertypes": []
|
|
1330
|
-
}
|
|
1345
|
+
"supertypes": [],
|
|
1346
|
+
"reserved": {}
|
|
1347
|
+
}
|
package/src/node-types.json
CHANGED
|
@@ -494,17 +494,17 @@
|
|
|
494
494
|
"named": true
|
|
495
495
|
}
|
|
496
496
|
]
|
|
497
|
+
},
|
|
498
|
+
"symbol": {
|
|
499
|
+
"multiple": false,
|
|
500
|
+
"required": true,
|
|
501
|
+
"types": [
|
|
502
|
+
{
|
|
503
|
+
"type": "symbol",
|
|
504
|
+
"named": true
|
|
505
|
+
}
|
|
506
|
+
]
|
|
497
507
|
}
|
|
498
|
-
},
|
|
499
|
-
"children": {
|
|
500
|
-
"multiple": false,
|
|
501
|
-
"required": true,
|
|
502
|
-
"types": [
|
|
503
|
-
{
|
|
504
|
-
"type": "symbol",
|
|
505
|
-
"named": true
|
|
506
|
-
}
|
|
507
|
-
]
|
|
508
508
|
}
|
|
509
509
|
},
|
|
510
510
|
{
|
|
@@ -526,6 +526,80 @@
|
|
|
526
526
|
"type": "node",
|
|
527
527
|
"named": true,
|
|
528
528
|
"fields": {
|
|
529
|
+
"attributes": {
|
|
530
|
+
"multiple": true,
|
|
531
|
+
"required": false,
|
|
532
|
+
"types": [
|
|
533
|
+
{
|
|
534
|
+
"type": "backticked_string",
|
|
535
|
+
"named": true
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"type": "decimal",
|
|
539
|
+
"named": true
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"type": "double_quoted_string",
|
|
543
|
+
"named": true
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"type": "fenced_string",
|
|
547
|
+
"named": true
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
"type": "greek",
|
|
551
|
+
"named": true
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"type": "hexadecimal",
|
|
555
|
+
"named": true
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
"type": "integer",
|
|
559
|
+
"named": true
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"type": "labels",
|
|
563
|
+
"named": true
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
"type": "math_symbol",
|
|
567
|
+
"named": true
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
"type": "measurement",
|
|
571
|
+
"named": true
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
"type": "octal",
|
|
575
|
+
"named": true
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
"type": "pictograph",
|
|
579
|
+
"named": true
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
"type": "range",
|
|
583
|
+
"named": true
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"type": "record",
|
|
587
|
+
"named": true
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"type": "single_quoted_string",
|
|
591
|
+
"named": true
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
"type": "symbol",
|
|
595
|
+
"named": true
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
"type": "tagged_string",
|
|
599
|
+
"named": true
|
|
600
|
+
}
|
|
601
|
+
]
|
|
602
|
+
},
|
|
529
603
|
"identifier": {
|
|
530
604
|
"multiple": false,
|
|
531
605
|
"required": false,
|
|
@@ -632,88 +706,95 @@
|
|
|
632
706
|
{
|
|
633
707
|
"type": "pattern_element",
|
|
634
708
|
"named": true,
|
|
635
|
-
"fields": {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
709
|
+
"fields": {
|
|
710
|
+
"annotations": {
|
|
711
|
+
"multiple": true,
|
|
712
|
+
"required": false,
|
|
713
|
+
"types": [
|
|
714
|
+
{
|
|
715
|
+
"type": "annotation",
|
|
716
|
+
"named": true
|
|
717
|
+
}
|
|
718
|
+
]
|
|
719
|
+
},
|
|
720
|
+
"element": {
|
|
721
|
+
"multiple": false,
|
|
722
|
+
"required": true,
|
|
723
|
+
"types": [
|
|
724
|
+
{
|
|
725
|
+
"type": "backticked_string",
|
|
726
|
+
"named": true
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
"type": "decimal",
|
|
730
|
+
"named": true
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"type": "double_quoted_string",
|
|
734
|
+
"named": true
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
"type": "fenced_string",
|
|
738
|
+
"named": true
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
"type": "greek",
|
|
742
|
+
"named": true
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
"type": "hexadecimal",
|
|
746
|
+
"named": true
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
"type": "integer",
|
|
750
|
+
"named": true
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
"type": "math_symbol",
|
|
754
|
+
"named": true
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"type": "measurement",
|
|
758
|
+
"named": true
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
"type": "node",
|
|
762
|
+
"named": true
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
"type": "octal",
|
|
766
|
+
"named": true
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
"type": "pictograph",
|
|
770
|
+
"named": true
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
"type": "range",
|
|
774
|
+
"named": true
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
"type": "relationship",
|
|
778
|
+
"named": true
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
"type": "single_quoted_string",
|
|
782
|
+
"named": true
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
"type": "subject",
|
|
786
|
+
"named": true
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
"type": "symbol",
|
|
790
|
+
"named": true
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
"type": "tagged_string",
|
|
794
|
+
"named": true
|
|
795
|
+
}
|
|
796
|
+
]
|
|
797
|
+
}
|
|
717
798
|
}
|
|
718
799
|
},
|
|
719
800
|
{
|