tree-sitter-bynk 0.79.0 → 0.80.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/grammar.js +23 -9
- package/package.json +2 -2
- package/queries/highlights.scm +2 -0
- package/src/grammar.json +72 -14
- package/src/node-types.json +154 -2
- package/src/parser.c +16414 -14985
- package/src/tree_sitter/array.h +110 -71
- package/src/tree_sitter/parser.h +27 -7
package/grammar.js
CHANGED
|
@@ -23,15 +23,17 @@
|
|
|
23
23
|
|
|
24
24
|
const PREC = {
|
|
25
25
|
assert: 0,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
// v0.80: `implies` is the lowest-precedence binary operator (below `||`).
|
|
27
|
+
implies: 1,
|
|
28
|
+
or: 2,
|
|
29
|
+
and: 3,
|
|
30
|
+
is: 4,
|
|
31
|
+
cmp: 5,
|
|
32
|
+
rel: 6,
|
|
33
|
+
add: 7,
|
|
34
|
+
mul: 8,
|
|
35
|
+
unary: 9,
|
|
36
|
+
postfix: 10,
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
module.exports = grammar({
|
|
@@ -549,9 +551,19 @@ module.exports = grammar({
|
|
|
549
551
|
"{",
|
|
550
552
|
field("key", $.key_decl),
|
|
551
553
|
field("state", $.state_decl),
|
|
554
|
+
repeat($.invariant_decl),
|
|
552
555
|
repeat($.handler),
|
|
553
556
|
"}",
|
|
554
557
|
),
|
|
558
|
+
// v0.80: an agent invariant — `invariant <name>: <predicate>`. Sits between
|
|
559
|
+
// the state block and the handlers.
|
|
560
|
+
invariant_decl: ($) =>
|
|
561
|
+
seq(
|
|
562
|
+
"invariant",
|
|
563
|
+
field("name", $.identifier),
|
|
564
|
+
":",
|
|
565
|
+
field("predicate", $._expression),
|
|
566
|
+
),
|
|
555
567
|
key_decl: ($) =>
|
|
556
568
|
seq("key", field("name", $.identifier), ":", field("type", $._type_ref)),
|
|
557
569
|
state_decl: ($) =>
|
|
@@ -848,6 +860,8 @@ module.exports = grammar({
|
|
|
848
860
|
|
|
849
861
|
binary_expr: ($) =>
|
|
850
862
|
choice(
|
|
863
|
+
// v0.80: `P implies Q` — right-associative, lowest precedence.
|
|
864
|
+
prec.right(PREC.implies, seq($._expression, "implies", $._expression)),
|
|
851
865
|
prec.left(PREC.or, seq($._expression, "||", $._expression)),
|
|
852
866
|
prec.left(PREC.and, seq($._expression, "&&", $._expression)),
|
|
853
867
|
prec.left(PREC.cmp, seq($._expression, choice("==", "!="), $._expression)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tree-sitter-bynk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.0",
|
|
4
4
|
"description": "Tree-sitter grammar for the Bynk DSL (v0–v0.16).",
|
|
5
5
|
"main": "bindings/node",
|
|
6
6
|
"types": "bindings/node",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"prebuildify": "^6.0.0",
|
|
42
|
-
"tree-sitter-cli": "^0.
|
|
42
|
+
"tree-sitter-cli": "^0.26.9"
|
|
43
43
|
},
|
|
44
44
|
"tree-sitter": [
|
|
45
45
|
{
|
package/queries/highlights.scm
CHANGED
package/src/grammar.json
CHANGED
|
@@ -2461,6 +2461,13 @@
|
|
|
2461
2461
|
"name": "state_decl"
|
|
2462
2462
|
}
|
|
2463
2463
|
},
|
|
2464
|
+
{
|
|
2465
|
+
"type": "REPEAT",
|
|
2466
|
+
"content": {
|
|
2467
|
+
"type": "SYMBOL",
|
|
2468
|
+
"name": "invariant_decl"
|
|
2469
|
+
}
|
|
2470
|
+
},
|
|
2464
2471
|
{
|
|
2465
2472
|
"type": "REPEAT",
|
|
2466
2473
|
"content": {
|
|
@@ -2474,6 +2481,35 @@
|
|
|
2474
2481
|
}
|
|
2475
2482
|
]
|
|
2476
2483
|
},
|
|
2484
|
+
"invariant_decl": {
|
|
2485
|
+
"type": "SEQ",
|
|
2486
|
+
"members": [
|
|
2487
|
+
{
|
|
2488
|
+
"type": "STRING",
|
|
2489
|
+
"value": "invariant"
|
|
2490
|
+
},
|
|
2491
|
+
{
|
|
2492
|
+
"type": "FIELD",
|
|
2493
|
+
"name": "name",
|
|
2494
|
+
"content": {
|
|
2495
|
+
"type": "SYMBOL",
|
|
2496
|
+
"name": "identifier"
|
|
2497
|
+
}
|
|
2498
|
+
},
|
|
2499
|
+
{
|
|
2500
|
+
"type": "STRING",
|
|
2501
|
+
"value": ":"
|
|
2502
|
+
},
|
|
2503
|
+
{
|
|
2504
|
+
"type": "FIELD",
|
|
2505
|
+
"name": "predicate",
|
|
2506
|
+
"content": {
|
|
2507
|
+
"type": "SYMBOL",
|
|
2508
|
+
"name": "_expression"
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
]
|
|
2512
|
+
},
|
|
2477
2513
|
"key_decl": {
|
|
2478
2514
|
"type": "SEQ",
|
|
2479
2515
|
"members": [
|
|
@@ -4115,7 +4151,7 @@
|
|
|
4115
4151
|
},
|
|
4116
4152
|
"is_expr": {
|
|
4117
4153
|
"type": "PREC_LEFT",
|
|
4118
|
-
"value":
|
|
4154
|
+
"value": 4,
|
|
4119
4155
|
"content": {
|
|
4120
4156
|
"type": "SEQ",
|
|
4121
4157
|
"members": [
|
|
@@ -4146,7 +4182,7 @@
|
|
|
4146
4182
|
"type": "CHOICE",
|
|
4147
4183
|
"members": [
|
|
4148
4184
|
{
|
|
4149
|
-
"type": "
|
|
4185
|
+
"type": "PREC_RIGHT",
|
|
4150
4186
|
"value": 1,
|
|
4151
4187
|
"content": {
|
|
4152
4188
|
"type": "SEQ",
|
|
@@ -4157,7 +4193,7 @@
|
|
|
4157
4193
|
},
|
|
4158
4194
|
{
|
|
4159
4195
|
"type": "STRING",
|
|
4160
|
-
"value": "
|
|
4196
|
+
"value": "implies"
|
|
4161
4197
|
},
|
|
4162
4198
|
{
|
|
4163
4199
|
"type": "SYMBOL",
|
|
@@ -4169,6 +4205,27 @@
|
|
|
4169
4205
|
{
|
|
4170
4206
|
"type": "PREC_LEFT",
|
|
4171
4207
|
"value": 2,
|
|
4208
|
+
"content": {
|
|
4209
|
+
"type": "SEQ",
|
|
4210
|
+
"members": [
|
|
4211
|
+
{
|
|
4212
|
+
"type": "SYMBOL",
|
|
4213
|
+
"name": "_expression"
|
|
4214
|
+
},
|
|
4215
|
+
{
|
|
4216
|
+
"type": "STRING",
|
|
4217
|
+
"value": "||"
|
|
4218
|
+
},
|
|
4219
|
+
{
|
|
4220
|
+
"type": "SYMBOL",
|
|
4221
|
+
"name": "_expression"
|
|
4222
|
+
}
|
|
4223
|
+
]
|
|
4224
|
+
}
|
|
4225
|
+
},
|
|
4226
|
+
{
|
|
4227
|
+
"type": "PREC_LEFT",
|
|
4228
|
+
"value": 3,
|
|
4172
4229
|
"content": {
|
|
4173
4230
|
"type": "SEQ",
|
|
4174
4231
|
"members": [
|
|
@@ -4189,7 +4246,7 @@
|
|
|
4189
4246
|
},
|
|
4190
4247
|
{
|
|
4191
4248
|
"type": "PREC_LEFT",
|
|
4192
|
-
"value":
|
|
4249
|
+
"value": 5,
|
|
4193
4250
|
"content": {
|
|
4194
4251
|
"type": "SEQ",
|
|
4195
4252
|
"members": [
|
|
@@ -4219,7 +4276,7 @@
|
|
|
4219
4276
|
},
|
|
4220
4277
|
{
|
|
4221
4278
|
"type": "PREC_LEFT",
|
|
4222
|
-
"value":
|
|
4279
|
+
"value": 6,
|
|
4223
4280
|
"content": {
|
|
4224
4281
|
"type": "SEQ",
|
|
4225
4282
|
"members": [
|
|
@@ -4257,7 +4314,7 @@
|
|
|
4257
4314
|
},
|
|
4258
4315
|
{
|
|
4259
4316
|
"type": "PREC_LEFT",
|
|
4260
|
-
"value":
|
|
4317
|
+
"value": 7,
|
|
4261
4318
|
"content": {
|
|
4262
4319
|
"type": "SEQ",
|
|
4263
4320
|
"members": [
|
|
@@ -4287,7 +4344,7 @@
|
|
|
4287
4344
|
},
|
|
4288
4345
|
{
|
|
4289
4346
|
"type": "PREC_LEFT",
|
|
4290
|
-
"value":
|
|
4347
|
+
"value": 8,
|
|
4291
4348
|
"content": {
|
|
4292
4349
|
"type": "SEQ",
|
|
4293
4350
|
"members": [
|
|
@@ -4319,7 +4376,7 @@
|
|
|
4319
4376
|
},
|
|
4320
4377
|
"unary_expr": {
|
|
4321
4378
|
"type": "PREC_RIGHT",
|
|
4322
|
-
"value":
|
|
4379
|
+
"value": 9,
|
|
4323
4380
|
"content": {
|
|
4324
4381
|
"type": "SEQ",
|
|
4325
4382
|
"members": [
|
|
@@ -4564,7 +4621,7 @@
|
|
|
4564
4621
|
},
|
|
4565
4622
|
"method_call": {
|
|
4566
4623
|
"type": "PREC_LEFT",
|
|
4567
|
-
"value":
|
|
4624
|
+
"value": 11,
|
|
4568
4625
|
"content": {
|
|
4569
4626
|
"type": "SEQ",
|
|
4570
4627
|
"members": [
|
|
@@ -4708,7 +4765,7 @@
|
|
|
4708
4765
|
},
|
|
4709
4766
|
"field_access": {
|
|
4710
4767
|
"type": "PREC_LEFT",
|
|
4711
|
-
"value":
|
|
4768
|
+
"value": 10,
|
|
4712
4769
|
"content": {
|
|
4713
4770
|
"type": "SEQ",
|
|
4714
4771
|
"members": [
|
|
@@ -4737,7 +4794,7 @@
|
|
|
4737
4794
|
},
|
|
4738
4795
|
"call": {
|
|
4739
4796
|
"type": "PREC_LEFT",
|
|
4740
|
-
"value":
|
|
4797
|
+
"value": 10,
|
|
4741
4798
|
"content": {
|
|
4742
4799
|
"type": "SEQ",
|
|
4743
4800
|
"members": [
|
|
@@ -5163,7 +5220,7 @@
|
|
|
5163
5220
|
},
|
|
5164
5221
|
"question_expr": {
|
|
5165
5222
|
"type": "PREC_LEFT",
|
|
5166
|
-
"value":
|
|
5223
|
+
"value": 10,
|
|
5167
5224
|
"content": {
|
|
5168
5225
|
"type": "SEQ",
|
|
5169
5226
|
"members": [
|
|
@@ -5590,5 +5647,6 @@
|
|
|
5590
5647
|
}
|
|
5591
5648
|
],
|
|
5592
5649
|
"inline": [],
|
|
5593
|
-
"supertypes": []
|
|
5594
|
-
}
|
|
5650
|
+
"supertypes": [],
|
|
5651
|
+
"reserved": {}
|
|
5652
|
+
}
|
package/src/node-types.json
CHANGED
|
@@ -193,6 +193,10 @@
|
|
|
193
193
|
{
|
|
194
194
|
"type": "handler",
|
|
195
195
|
"named": true
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"type": "invariant_decl",
|
|
199
|
+
"named": true
|
|
196
200
|
}
|
|
197
201
|
]
|
|
198
202
|
}
|
|
@@ -2800,6 +2804,144 @@
|
|
|
2800
2804
|
]
|
|
2801
2805
|
}
|
|
2802
2806
|
},
|
|
2807
|
+
{
|
|
2808
|
+
"type": "invariant_decl",
|
|
2809
|
+
"named": true,
|
|
2810
|
+
"fields": {
|
|
2811
|
+
"name": {
|
|
2812
|
+
"multiple": false,
|
|
2813
|
+
"required": true,
|
|
2814
|
+
"types": [
|
|
2815
|
+
{
|
|
2816
|
+
"type": "identifier",
|
|
2817
|
+
"named": true
|
|
2818
|
+
}
|
|
2819
|
+
]
|
|
2820
|
+
},
|
|
2821
|
+
"predicate": {
|
|
2822
|
+
"multiple": false,
|
|
2823
|
+
"required": true,
|
|
2824
|
+
"types": [
|
|
2825
|
+
{
|
|
2826
|
+
"type": "assert_expr",
|
|
2827
|
+
"named": true
|
|
2828
|
+
},
|
|
2829
|
+
{
|
|
2830
|
+
"type": "binary_expr",
|
|
2831
|
+
"named": true
|
|
2832
|
+
},
|
|
2833
|
+
{
|
|
2834
|
+
"type": "block",
|
|
2835
|
+
"named": true
|
|
2836
|
+
},
|
|
2837
|
+
{
|
|
2838
|
+
"type": "boolean_literal",
|
|
2839
|
+
"named": true
|
|
2840
|
+
},
|
|
2841
|
+
{
|
|
2842
|
+
"type": "call",
|
|
2843
|
+
"named": true
|
|
2844
|
+
},
|
|
2845
|
+
{
|
|
2846
|
+
"type": "effect_pure_expr",
|
|
2847
|
+
"named": true
|
|
2848
|
+
},
|
|
2849
|
+
{
|
|
2850
|
+
"type": "err_expr",
|
|
2851
|
+
"named": true
|
|
2852
|
+
},
|
|
2853
|
+
{
|
|
2854
|
+
"type": "field_access",
|
|
2855
|
+
"named": true
|
|
2856
|
+
},
|
|
2857
|
+
{
|
|
2858
|
+
"type": "float_literal",
|
|
2859
|
+
"named": true
|
|
2860
|
+
},
|
|
2861
|
+
{
|
|
2862
|
+
"type": "identifier",
|
|
2863
|
+
"named": true
|
|
2864
|
+
},
|
|
2865
|
+
{
|
|
2866
|
+
"type": "if_expr",
|
|
2867
|
+
"named": true
|
|
2868
|
+
},
|
|
2869
|
+
{
|
|
2870
|
+
"type": "is_expr",
|
|
2871
|
+
"named": true
|
|
2872
|
+
},
|
|
2873
|
+
{
|
|
2874
|
+
"type": "lambda_expr",
|
|
2875
|
+
"named": true
|
|
2876
|
+
},
|
|
2877
|
+
{
|
|
2878
|
+
"type": "list_literal",
|
|
2879
|
+
"named": true
|
|
2880
|
+
},
|
|
2881
|
+
{
|
|
2882
|
+
"type": "match_expr",
|
|
2883
|
+
"named": true
|
|
2884
|
+
},
|
|
2885
|
+
{
|
|
2886
|
+
"type": "method_call",
|
|
2887
|
+
"named": true
|
|
2888
|
+
},
|
|
2889
|
+
{
|
|
2890
|
+
"type": "mock_expr",
|
|
2891
|
+
"named": true
|
|
2892
|
+
},
|
|
2893
|
+
{
|
|
2894
|
+
"type": "none_expr",
|
|
2895
|
+
"named": true
|
|
2896
|
+
},
|
|
2897
|
+
{
|
|
2898
|
+
"type": "number_literal",
|
|
2899
|
+
"named": true
|
|
2900
|
+
},
|
|
2901
|
+
{
|
|
2902
|
+
"type": "ok_expr",
|
|
2903
|
+
"named": true
|
|
2904
|
+
},
|
|
2905
|
+
{
|
|
2906
|
+
"type": "paren_expr",
|
|
2907
|
+
"named": true
|
|
2908
|
+
},
|
|
2909
|
+
{
|
|
2910
|
+
"type": "question_expr",
|
|
2911
|
+
"named": true
|
|
2912
|
+
},
|
|
2913
|
+
{
|
|
2914
|
+
"type": "record_construction",
|
|
2915
|
+
"named": true
|
|
2916
|
+
},
|
|
2917
|
+
{
|
|
2918
|
+
"type": "record_spread",
|
|
2919
|
+
"named": true
|
|
2920
|
+
},
|
|
2921
|
+
{
|
|
2922
|
+
"type": "self_expr",
|
|
2923
|
+
"named": true
|
|
2924
|
+
},
|
|
2925
|
+
{
|
|
2926
|
+
"type": "some_expr",
|
|
2927
|
+
"named": true
|
|
2928
|
+
},
|
|
2929
|
+
{
|
|
2930
|
+
"type": "string_literal",
|
|
2931
|
+
"named": true
|
|
2932
|
+
},
|
|
2933
|
+
{
|
|
2934
|
+
"type": "unary_expr",
|
|
2935
|
+
"named": true
|
|
2936
|
+
},
|
|
2937
|
+
{
|
|
2938
|
+
"type": "unit_literal",
|
|
2939
|
+
"named": true
|
|
2940
|
+
}
|
|
2941
|
+
]
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
},
|
|
2803
2945
|
{
|
|
2804
2946
|
"type": "is_expr",
|
|
2805
2947
|
"named": true,
|
|
@@ -6756,7 +6898,8 @@
|
|
|
6756
6898
|
},
|
|
6757
6899
|
{
|
|
6758
6900
|
"type": "doc_block",
|
|
6759
|
-
"named": true
|
|
6901
|
+
"named": true,
|
|
6902
|
+
"extra": true
|
|
6760
6903
|
},
|
|
6761
6904
|
{
|
|
6762
6905
|
"type": "else",
|
|
@@ -6806,10 +6949,18 @@
|
|
|
6806
6949
|
"type": "if",
|
|
6807
6950
|
"named": false
|
|
6808
6951
|
},
|
|
6952
|
+
{
|
|
6953
|
+
"type": "implies",
|
|
6954
|
+
"named": false
|
|
6955
|
+
},
|
|
6809
6956
|
{
|
|
6810
6957
|
"type": "integration",
|
|
6811
6958
|
"named": false
|
|
6812
6959
|
},
|
|
6960
|
+
{
|
|
6961
|
+
"type": "invariant",
|
|
6962
|
+
"named": false
|
|
6963
|
+
},
|
|
6813
6964
|
{
|
|
6814
6965
|
"type": "is",
|
|
6815
6966
|
"named": false
|
|
@@ -6824,7 +6975,8 @@
|
|
|
6824
6975
|
},
|
|
6825
6976
|
{
|
|
6826
6977
|
"type": "line_comment",
|
|
6827
|
-
"named": true
|
|
6978
|
+
"named": true,
|
|
6979
|
+
"extra": true
|
|
6828
6980
|
},
|
|
6829
6981
|
{
|
|
6830
6982
|
"type": "match",
|