@gram-data/tree-sitter-gram 0.1.10 → 0.1.11
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 +28 -24
- package/package.json +5 -2
- 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 +108 -101
- package/src/node-types.json +232 -1071
- package/src/parser.c +1329 -1531
package/grammar.js
CHANGED
|
@@ -66,27 +66,25 @@ module.exports = grammar({
|
|
|
66
66
|
$.pictograph
|
|
67
67
|
),
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
_binder: $ => token(/::?/),
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
labels: $ => repeat1($.label),
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
label: $ => seq($._binder, field("symbol", $.symbol)),
|
|
74
74
|
|
|
75
75
|
record: $ => seq("{", commaSep($.property), "}"),
|
|
76
76
|
|
|
77
|
-
property: $ => seq(
|
|
78
|
-
field('key', $._key),
|
|
79
|
-
field('binder', $.binder),
|
|
80
|
-
field('value', $._value),
|
|
81
|
-
optional(field('cardinality', choice('!', '?', '*', '+')))
|
|
82
|
-
),
|
|
83
|
-
|
|
84
|
-
|
|
85
77
|
_key: $ => choice(
|
|
86
78
|
$.symbol,
|
|
87
79
|
$._string_literal
|
|
88
80
|
),
|
|
89
81
|
|
|
82
|
+
property: $ => seq(
|
|
83
|
+
field('key', $._key),
|
|
84
|
+
$._binder,
|
|
85
|
+
field('value', $._value)
|
|
86
|
+
),
|
|
87
|
+
|
|
90
88
|
symbol: $ => token(/[a-zA-Z_][0-9a-zA-Z_.\-@]*/),
|
|
91
89
|
|
|
92
90
|
|
|
@@ -168,20 +166,26 @@ module.exports = grammar({
|
|
|
168
166
|
},
|
|
169
167
|
|
|
170
168
|
_relationship_value: $ => choice(
|
|
171
|
-
$.single_undirected,
|
|
172
|
-
$.
|
|
173
|
-
$.
|
|
174
|
-
$.
|
|
175
|
-
$.
|
|
176
|
-
$.
|
|
177
|
-
$.
|
|
178
|
-
$.double_left,
|
|
179
|
-
$.
|
|
180
|
-
$.
|
|
181
|
-
$.
|
|
182
|
-
$.
|
|
169
|
+
alias($.single_undirected, $.undirected),
|
|
170
|
+
alias($.double_undirected, $.undirected),
|
|
171
|
+
alias($.squiggle_undirected, $.undirected),
|
|
172
|
+
alias($.single_bidirectional, $.bidirectional),
|
|
173
|
+
alias($.double_bidirectional, $.bidirectional),
|
|
174
|
+
alias($.squiggle_bidirectional, $.bidirectional),
|
|
175
|
+
alias($.single_left, $.left),
|
|
176
|
+
alias($.double_left, $.left),
|
|
177
|
+
alias($.squiggle_left, $.left),
|
|
178
|
+
alias($.single_right, $.right),
|
|
179
|
+
alias($.double_right, $.right),
|
|
180
|
+
alias($.squiggle_right, $.right)
|
|
183
181
|
),
|
|
184
|
-
|
|
182
|
+
|
|
183
|
+
// undirected: $ => alias(choice(
|
|
184
|
+
// $.single_undirected,
|
|
185
|
+
// $.double_undirected,
|
|
186
|
+
// $.squiggle_undirected
|
|
187
|
+
// ), $.undirected),
|
|
188
|
+
|
|
185
189
|
single_undirected: $ => seq("-", optional(seq("[", $._attributes, "]")), "-"),
|
|
186
190
|
single_bidirectional: $ => seq("<-", optional(seq("[", $._attributes, "]")), "->"),
|
|
187
191
|
single_right: $ => seq("-", optional(seq("[", $._attributes, "]")), "->"),
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gram-data/tree-sitter-gram",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "subject-oriented notation for structured data",
|
|
5
5
|
"homepage": "https://gram-data.github.io",
|
|
6
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/gram-data/tree-sitter-gram.git"
|
|
9
|
+
},
|
|
7
10
|
"main": "bindings/node",
|
|
8
11
|
"types": "bindings/node",
|
|
9
12
|
"scripts": {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/grammar.json
CHANGED
|
@@ -442,6 +442,13 @@
|
|
|
442
442
|
}
|
|
443
443
|
]
|
|
444
444
|
},
|
|
445
|
+
"_binder": {
|
|
446
|
+
"type": "TOKEN",
|
|
447
|
+
"content": {
|
|
448
|
+
"type": "PATTERN",
|
|
449
|
+
"value": "::?"
|
|
450
|
+
}
|
|
451
|
+
},
|
|
445
452
|
"labels": {
|
|
446
453
|
"type": "REPEAT1",
|
|
447
454
|
"content": {
|
|
@@ -453,12 +460,8 @@
|
|
|
453
460
|
"type": "SEQ",
|
|
454
461
|
"members": [
|
|
455
462
|
{
|
|
456
|
-
"type": "
|
|
457
|
-
"name": "
|
|
458
|
-
"content": {
|
|
459
|
-
"type": "SYMBOL",
|
|
460
|
-
"name": "binder"
|
|
461
|
-
}
|
|
463
|
+
"type": "SYMBOL",
|
|
464
|
+
"name": "_binder"
|
|
462
465
|
},
|
|
463
466
|
{
|
|
464
467
|
"type": "FIELD",
|
|
@@ -470,25 +473,6 @@
|
|
|
470
473
|
}
|
|
471
474
|
]
|
|
472
475
|
},
|
|
473
|
-
"binder": {
|
|
474
|
-
"type": "CHOICE",
|
|
475
|
-
"members": [
|
|
476
|
-
{
|
|
477
|
-
"type": "TOKEN",
|
|
478
|
-
"content": {
|
|
479
|
-
"type": "STRING",
|
|
480
|
-
"value": ":"
|
|
481
|
-
}
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
"type": "TOKEN",
|
|
485
|
-
"content": {
|
|
486
|
-
"type": "STRING",
|
|
487
|
-
"value": "::"
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
]
|
|
491
|
-
},
|
|
492
476
|
"record": {
|
|
493
477
|
"type": "SEQ",
|
|
494
478
|
"members": [
|
|
@@ -535,6 +519,19 @@
|
|
|
535
519
|
}
|
|
536
520
|
]
|
|
537
521
|
},
|
|
522
|
+
"_key": {
|
|
523
|
+
"type": "CHOICE",
|
|
524
|
+
"members": [
|
|
525
|
+
{
|
|
526
|
+
"type": "SYMBOL",
|
|
527
|
+
"name": "symbol"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"type": "SYMBOL",
|
|
531
|
+
"name": "_string_literal"
|
|
532
|
+
}
|
|
533
|
+
]
|
|
534
|
+
},
|
|
538
535
|
"property": {
|
|
539
536
|
"type": "SEQ",
|
|
540
537
|
"members": [
|
|
@@ -547,12 +544,8 @@
|
|
|
547
544
|
}
|
|
548
545
|
},
|
|
549
546
|
{
|
|
550
|
-
"type": "
|
|
551
|
-
"name": "
|
|
552
|
-
"content": {
|
|
553
|
-
"type": "SYMBOL",
|
|
554
|
-
"name": "binder"
|
|
555
|
-
}
|
|
547
|
+
"type": "SYMBOL",
|
|
548
|
+
"name": "_binder"
|
|
556
549
|
},
|
|
557
550
|
{
|
|
558
551
|
"type": "FIELD",
|
|
@@ -561,52 +554,6 @@
|
|
|
561
554
|
"type": "SYMBOL",
|
|
562
555
|
"name": "_value"
|
|
563
556
|
}
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
"type": "CHOICE",
|
|
567
|
-
"members": [
|
|
568
|
-
{
|
|
569
|
-
"type": "FIELD",
|
|
570
|
-
"name": "cardinality",
|
|
571
|
-
"content": {
|
|
572
|
-
"type": "CHOICE",
|
|
573
|
-
"members": [
|
|
574
|
-
{
|
|
575
|
-
"type": "STRING",
|
|
576
|
-
"value": "!"
|
|
577
|
-
},
|
|
578
|
-
{
|
|
579
|
-
"type": "STRING",
|
|
580
|
-
"value": "?"
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
"type": "STRING",
|
|
584
|
-
"value": "*"
|
|
585
|
-
},
|
|
586
|
-
{
|
|
587
|
-
"type": "STRING",
|
|
588
|
-
"value": "+"
|
|
589
|
-
}
|
|
590
|
-
]
|
|
591
|
-
}
|
|
592
|
-
},
|
|
593
|
-
{
|
|
594
|
-
"type": "BLANK"
|
|
595
|
-
}
|
|
596
|
-
]
|
|
597
|
-
}
|
|
598
|
-
]
|
|
599
|
-
},
|
|
600
|
-
"_key": {
|
|
601
|
-
"type": "CHOICE",
|
|
602
|
-
"members": [
|
|
603
|
-
{
|
|
604
|
-
"type": "SYMBOL",
|
|
605
|
-
"name": "symbol"
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
"type": "SYMBOL",
|
|
609
|
-
"name": "_string_literal"
|
|
610
557
|
}
|
|
611
558
|
]
|
|
612
559
|
},
|
|
@@ -826,52 +773,112 @@
|
|
|
826
773
|
"type": "CHOICE",
|
|
827
774
|
"members": [
|
|
828
775
|
{
|
|
829
|
-
"type": "
|
|
830
|
-
"
|
|
776
|
+
"type": "ALIAS",
|
|
777
|
+
"content": {
|
|
778
|
+
"type": "SYMBOL",
|
|
779
|
+
"name": "single_undirected"
|
|
780
|
+
},
|
|
781
|
+
"named": true,
|
|
782
|
+
"value": "undirected"
|
|
831
783
|
},
|
|
832
784
|
{
|
|
833
|
-
"type": "
|
|
834
|
-
"
|
|
785
|
+
"type": "ALIAS",
|
|
786
|
+
"content": {
|
|
787
|
+
"type": "SYMBOL",
|
|
788
|
+
"name": "double_undirected"
|
|
789
|
+
},
|
|
790
|
+
"named": true,
|
|
791
|
+
"value": "undirected"
|
|
835
792
|
},
|
|
836
793
|
{
|
|
837
|
-
"type": "
|
|
838
|
-
"
|
|
794
|
+
"type": "ALIAS",
|
|
795
|
+
"content": {
|
|
796
|
+
"type": "SYMBOL",
|
|
797
|
+
"name": "squiggle_undirected"
|
|
798
|
+
},
|
|
799
|
+
"named": true,
|
|
800
|
+
"value": "undirected"
|
|
839
801
|
},
|
|
840
802
|
{
|
|
841
|
-
"type": "
|
|
842
|
-
"
|
|
803
|
+
"type": "ALIAS",
|
|
804
|
+
"content": {
|
|
805
|
+
"type": "SYMBOL",
|
|
806
|
+
"name": "single_bidirectional"
|
|
807
|
+
},
|
|
808
|
+
"named": true,
|
|
809
|
+
"value": "bidirectional"
|
|
843
810
|
},
|
|
844
811
|
{
|
|
845
|
-
"type": "
|
|
846
|
-
"
|
|
812
|
+
"type": "ALIAS",
|
|
813
|
+
"content": {
|
|
814
|
+
"type": "SYMBOL",
|
|
815
|
+
"name": "double_bidirectional"
|
|
816
|
+
},
|
|
817
|
+
"named": true,
|
|
818
|
+
"value": "bidirectional"
|
|
847
819
|
},
|
|
848
820
|
{
|
|
849
|
-
"type": "
|
|
850
|
-
"
|
|
821
|
+
"type": "ALIAS",
|
|
822
|
+
"content": {
|
|
823
|
+
"type": "SYMBOL",
|
|
824
|
+
"name": "squiggle_bidirectional"
|
|
825
|
+
},
|
|
826
|
+
"named": true,
|
|
827
|
+
"value": "bidirectional"
|
|
851
828
|
},
|
|
852
829
|
{
|
|
853
|
-
"type": "
|
|
854
|
-
"
|
|
830
|
+
"type": "ALIAS",
|
|
831
|
+
"content": {
|
|
832
|
+
"type": "SYMBOL",
|
|
833
|
+
"name": "single_left"
|
|
834
|
+
},
|
|
835
|
+
"named": true,
|
|
836
|
+
"value": "left"
|
|
855
837
|
},
|
|
856
838
|
{
|
|
857
|
-
"type": "
|
|
858
|
-
"
|
|
839
|
+
"type": "ALIAS",
|
|
840
|
+
"content": {
|
|
841
|
+
"type": "SYMBOL",
|
|
842
|
+
"name": "double_left"
|
|
843
|
+
},
|
|
844
|
+
"named": true,
|
|
845
|
+
"value": "left"
|
|
859
846
|
},
|
|
860
847
|
{
|
|
861
|
-
"type": "
|
|
862
|
-
"
|
|
848
|
+
"type": "ALIAS",
|
|
849
|
+
"content": {
|
|
850
|
+
"type": "SYMBOL",
|
|
851
|
+
"name": "squiggle_left"
|
|
852
|
+
},
|
|
853
|
+
"named": true,
|
|
854
|
+
"value": "left"
|
|
863
855
|
},
|
|
864
856
|
{
|
|
865
|
-
"type": "
|
|
866
|
-
"
|
|
857
|
+
"type": "ALIAS",
|
|
858
|
+
"content": {
|
|
859
|
+
"type": "SYMBOL",
|
|
860
|
+
"name": "single_right"
|
|
861
|
+
},
|
|
862
|
+
"named": true,
|
|
863
|
+
"value": "right"
|
|
867
864
|
},
|
|
868
865
|
{
|
|
869
|
-
"type": "
|
|
870
|
-
"
|
|
866
|
+
"type": "ALIAS",
|
|
867
|
+
"content": {
|
|
868
|
+
"type": "SYMBOL",
|
|
869
|
+
"name": "double_right"
|
|
870
|
+
},
|
|
871
|
+
"named": true,
|
|
872
|
+
"value": "right"
|
|
871
873
|
},
|
|
872
874
|
{
|
|
873
|
-
"type": "
|
|
874
|
-
"
|
|
875
|
+
"type": "ALIAS",
|
|
876
|
+
"content": {
|
|
877
|
+
"type": "SYMBOL",
|
|
878
|
+
"name": "squiggle_right"
|
|
879
|
+
},
|
|
880
|
+
"named": true,
|
|
881
|
+
"value": "right"
|
|
875
882
|
}
|
|
876
883
|
]
|
|
877
884
|
},
|