tree-sitter-bynk 0.80.0 → 0.97.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 +44 -14
- package/package.json +1 -1
- package/queries/highlights.scm +2 -3
- package/src/grammar.json +226 -28
- package/src/node-types.json +543 -174
- package/src/parser.c +29025 -26351
package/grammar.js
CHANGED
|
@@ -48,7 +48,7 @@ module.exports = grammar({
|
|
|
48
48
|
word: ($) => $.identifier,
|
|
49
49
|
|
|
50
50
|
conflicts: ($) => [
|
|
51
|
-
// `match e { … }` / `if e { … }
|
|
51
|
+
// `match e { … }` / `if e { … }`: after a bare identifier `e`,
|
|
52
52
|
// the `{` is ambiguous between opening the match/if body and opening a
|
|
53
53
|
// record construction/spread `e { … }`. Keep all parses alive; the body
|
|
54
54
|
// content (match arms / block statements vs field inits) decides which one
|
|
@@ -95,7 +95,7 @@ module.exports = grammar({
|
|
|
95
95
|
),
|
|
96
96
|
|
|
97
97
|
_item_fragment: ($) =>
|
|
98
|
-
choice($._context_body_item, $.handler, $.
|
|
98
|
+
choice($._context_body_item, $.handler, $.store_field, $.key_decl),
|
|
99
99
|
|
|
100
100
|
// The body of a fragment block: statements then an optional tail value,
|
|
101
101
|
// mirroring `block` so multi-statement and bare-expression snippets parse.
|
|
@@ -330,7 +330,7 @@ module.exports = grammar({
|
|
|
330
330
|
field("type", $._type_ref),
|
|
331
331
|
optional(seq("where", field("refinement", $.refinement))),
|
|
332
332
|
// v0.11: an optional initial-value expression. Meaningful on agent
|
|
333
|
-
// `
|
|
333
|
+
// `store` fields; the checker restricts where it applies.
|
|
334
334
|
optional(seq("=", field("init", $._expression))),
|
|
335
335
|
),
|
|
336
336
|
|
|
@@ -387,7 +387,7 @@ module.exports = grammar({
|
|
|
387
387
|
_pred_arg: ($) => choice($.number_literal, $.float_literal, $.string_literal),
|
|
388
388
|
|
|
389
389
|
_base_type: ($) => $.base_type,
|
|
390
|
-
base_type: () => choice("Int", "String", "Bool", "Float"),
|
|
390
|
+
base_type: () => choice("Int", "String", "Bool", "Float", "Duration", "Instant"),
|
|
391
391
|
|
|
392
392
|
_type_ref: ($) =>
|
|
393
393
|
choice(
|
|
@@ -550,13 +550,14 @@ module.exports = grammar({
|
|
|
550
550
|
field("name", $.identifier),
|
|
551
551
|
"{",
|
|
552
552
|
field("key", $.key_decl),
|
|
553
|
-
|
|
553
|
+
// v0.81 (storage track): the agent's `store` fields (ADR 0108).
|
|
554
|
+
repeat($.store_field),
|
|
554
555
|
repeat($.invariant_decl),
|
|
555
556
|
repeat($.handler),
|
|
556
557
|
"}",
|
|
557
558
|
),
|
|
558
559
|
// v0.80: an agent invariant — `invariant <name>: <predicate>`. Sits between
|
|
559
|
-
// the
|
|
560
|
+
// the store fields and the handlers.
|
|
560
561
|
invariant_decl: ($) =>
|
|
561
562
|
seq(
|
|
562
563
|
"invariant",
|
|
@@ -566,13 +567,40 @@ module.exports = grammar({
|
|
|
566
567
|
),
|
|
567
568
|
key_decl: ($) =>
|
|
568
569
|
seq("key", field("name", $.identifier), ":", field("type", $._type_ref)),
|
|
569
|
-
|
|
570
|
+
// v0.81 (storage track): `store <name>: <Kind>[…] [= init]`. `store` is a
|
|
571
|
+
// contextual keyword (also a valid identifier — e.g. a `cache.store`
|
|
572
|
+
// context); the `word` directive resolves it by context.
|
|
573
|
+
store_field: ($) =>
|
|
570
574
|
seq(
|
|
571
|
-
"
|
|
572
|
-
"
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
"
|
|
575
|
+
"store",
|
|
576
|
+
field("name", $.identifier),
|
|
577
|
+
":",
|
|
578
|
+
field("kind", $.store_kind),
|
|
579
|
+
repeat(field("annotation", $.store_annotation)),
|
|
580
|
+
optional(seq("=", field("init", $._expression))),
|
|
581
|
+
),
|
|
582
|
+
store_kind: ($) =>
|
|
583
|
+
seq(
|
|
584
|
+
field("head", $.identifier),
|
|
585
|
+
optional(seq("[", sep1($._type_ref, ","), "]")),
|
|
586
|
+
),
|
|
587
|
+
|
|
588
|
+
// v0.85 (storage track; ADR 0111): `@<name>(<args>)` field annotations.
|
|
589
|
+
// `@` appears only here; the name is an ordinary identifier (the checker
|
|
590
|
+
// matches the closed registry). An argument is an optional `label:` then a
|
|
591
|
+
// value expression — `by: orderId`, `5.minutes`.
|
|
592
|
+
store_annotation: ($) =>
|
|
593
|
+
seq(
|
|
594
|
+
"@",
|
|
595
|
+
field("name", $.identifier),
|
|
596
|
+
optional(
|
|
597
|
+
seq("(", optional(sep1($.annotation_arg, ",")), optional(","), ")"),
|
|
598
|
+
),
|
|
599
|
+
),
|
|
600
|
+
annotation_arg: ($) =>
|
|
601
|
+
seq(
|
|
602
|
+
optional(seq(field("label", $.identifier), ":")),
|
|
603
|
+
field("value", $._expression),
|
|
576
604
|
),
|
|
577
605
|
|
|
578
606
|
// v0.5 `on call`; v0.44 `on GET("path")` / `on schedule("expr")` /
|
|
@@ -746,7 +774,7 @@ module.exports = grammar({
|
|
|
746
774
|
$.let_stmt,
|
|
747
775
|
$.effect_let_stmt,
|
|
748
776
|
$.effect_send_stmt,
|
|
749
|
-
$.
|
|
777
|
+
$.assign_stmt,
|
|
750
778
|
prec(1, $.assert_expr),
|
|
751
779
|
),
|
|
752
780
|
|
|
@@ -768,7 +796,9 @@ module.exports = grammar({
|
|
|
768
796
|
),
|
|
769
797
|
// v0.79: `~> expr` — an asynchronous fire-and-forget send (no binder).
|
|
770
798
|
effect_send_stmt: ($) => seq("~>", field("value", $._expression)),
|
|
771
|
-
|
|
799
|
+
// v0.81 (storage track): `name := expr` — a `Cell` store write.
|
|
800
|
+
assign_stmt: ($) =>
|
|
801
|
+
seq(field("target", $.identifier), ":=", field("value", $._expression)),
|
|
772
802
|
|
|
773
803
|
// A let/effect-let may bind the discard name `_`.
|
|
774
804
|
_binding_name: ($) => choice($.identifier, alias("_", $.wildcard)),
|
package/package.json
CHANGED
package/queries/highlights.scm
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"let"
|
|
12
12
|
"match"
|
|
13
13
|
"is"
|
|
14
|
-
"commit"
|
|
15
14
|
"assert"
|
|
16
15
|
"on"
|
|
17
16
|
"given"
|
|
@@ -39,7 +38,7 @@
|
|
|
39
38
|
"provides"
|
|
40
39
|
"service"
|
|
41
40
|
"agent"
|
|
42
|
-
"
|
|
41
|
+
"store"
|
|
43
42
|
"exports"
|
|
44
43
|
"key"
|
|
45
44
|
"test"
|
|
@@ -153,7 +152,7 @@
|
|
|
153
152
|
"+" "-" "*" "/"
|
|
154
153
|
"==" "!=" "<" "<=" ">" ">="
|
|
155
154
|
"&&" "||" "!"
|
|
156
|
-
"<-" "~>" "->" "=" "?"
|
|
155
|
+
"<-" "~>" ":=" "->" "=" "?"
|
|
157
156
|
] @operator
|
|
158
157
|
|
|
159
158
|
[
|
package/src/grammar.json
CHANGED
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
"type": "SYMBOL",
|
|
63
|
-
"name": "
|
|
63
|
+
"name": "store_field"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"type": "SYMBOL",
|
|
@@ -1576,6 +1576,14 @@
|
|
|
1576
1576
|
{
|
|
1577
1577
|
"type": "STRING",
|
|
1578
1578
|
"value": "Float"
|
|
1579
|
+
},
|
|
1580
|
+
{
|
|
1581
|
+
"type": "STRING",
|
|
1582
|
+
"value": "Duration"
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
"type": "STRING",
|
|
1586
|
+
"value": "Instant"
|
|
1579
1587
|
}
|
|
1580
1588
|
]
|
|
1581
1589
|
},
|
|
@@ -2454,11 +2462,10 @@
|
|
|
2454
2462
|
}
|
|
2455
2463
|
},
|
|
2456
2464
|
{
|
|
2457
|
-
"type": "
|
|
2458
|
-
"name": "state",
|
|
2465
|
+
"type": "REPEAT",
|
|
2459
2466
|
"content": {
|
|
2460
2467
|
"type": "SYMBOL",
|
|
2461
|
-
"name": "
|
|
2468
|
+
"name": "store_field"
|
|
2462
2469
|
}
|
|
2463
2470
|
},
|
|
2464
2471
|
{
|
|
@@ -2539,16 +2546,43 @@
|
|
|
2539
2546
|
}
|
|
2540
2547
|
]
|
|
2541
2548
|
},
|
|
2542
|
-
"
|
|
2549
|
+
"store_field": {
|
|
2543
2550
|
"type": "SEQ",
|
|
2544
2551
|
"members": [
|
|
2545
2552
|
{
|
|
2546
2553
|
"type": "STRING",
|
|
2547
|
-
"value": "
|
|
2554
|
+
"value": "store"
|
|
2555
|
+
},
|
|
2556
|
+
{
|
|
2557
|
+
"type": "FIELD",
|
|
2558
|
+
"name": "name",
|
|
2559
|
+
"content": {
|
|
2560
|
+
"type": "SYMBOL",
|
|
2561
|
+
"name": "identifier"
|
|
2562
|
+
}
|
|
2548
2563
|
},
|
|
2549
2564
|
{
|
|
2550
2565
|
"type": "STRING",
|
|
2551
|
-
"value": "
|
|
2566
|
+
"value": ":"
|
|
2567
|
+
},
|
|
2568
|
+
{
|
|
2569
|
+
"type": "FIELD",
|
|
2570
|
+
"name": "kind",
|
|
2571
|
+
"content": {
|
|
2572
|
+
"type": "SYMBOL",
|
|
2573
|
+
"name": "store_kind"
|
|
2574
|
+
}
|
|
2575
|
+
},
|
|
2576
|
+
{
|
|
2577
|
+
"type": "REPEAT",
|
|
2578
|
+
"content": {
|
|
2579
|
+
"type": "FIELD",
|
|
2580
|
+
"name": "annotation",
|
|
2581
|
+
"content": {
|
|
2582
|
+
"type": "SYMBOL",
|
|
2583
|
+
"name": "store_annotation"
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2552
2586
|
},
|
|
2553
2587
|
{
|
|
2554
2588
|
"type": "CHOICE",
|
|
@@ -2557,23 +2591,15 @@
|
|
|
2557
2591
|
"type": "SEQ",
|
|
2558
2592
|
"members": [
|
|
2559
2593
|
{
|
|
2560
|
-
"type": "
|
|
2561
|
-
"
|
|
2594
|
+
"type": "STRING",
|
|
2595
|
+
"value": "="
|
|
2562
2596
|
},
|
|
2563
2597
|
{
|
|
2564
|
-
"type": "
|
|
2598
|
+
"type": "FIELD",
|
|
2599
|
+
"name": "init",
|
|
2565
2600
|
"content": {
|
|
2566
|
-
"type": "
|
|
2567
|
-
"
|
|
2568
|
-
{
|
|
2569
|
-
"type": "STRING",
|
|
2570
|
-
"value": ","
|
|
2571
|
-
},
|
|
2572
|
-
{
|
|
2573
|
-
"type": "SYMBOL",
|
|
2574
|
-
"name": "record_field"
|
|
2575
|
-
}
|
|
2576
|
-
]
|
|
2601
|
+
"type": "SYMBOL",
|
|
2602
|
+
"name": "_expression"
|
|
2577
2603
|
}
|
|
2578
2604
|
}
|
|
2579
2605
|
]
|
|
@@ -2582,22 +2608,186 @@
|
|
|
2582
2608
|
"type": "BLANK"
|
|
2583
2609
|
}
|
|
2584
2610
|
]
|
|
2611
|
+
}
|
|
2612
|
+
]
|
|
2613
|
+
},
|
|
2614
|
+
"store_kind": {
|
|
2615
|
+
"type": "SEQ",
|
|
2616
|
+
"members": [
|
|
2617
|
+
{
|
|
2618
|
+
"type": "FIELD",
|
|
2619
|
+
"name": "head",
|
|
2620
|
+
"content": {
|
|
2621
|
+
"type": "SYMBOL",
|
|
2622
|
+
"name": "identifier"
|
|
2623
|
+
}
|
|
2585
2624
|
},
|
|
2586
2625
|
{
|
|
2587
2626
|
"type": "CHOICE",
|
|
2588
2627
|
"members": [
|
|
2589
2628
|
{
|
|
2590
|
-
"type": "
|
|
2591
|
-
"
|
|
2629
|
+
"type": "SEQ",
|
|
2630
|
+
"members": [
|
|
2631
|
+
{
|
|
2632
|
+
"type": "STRING",
|
|
2633
|
+
"value": "["
|
|
2634
|
+
},
|
|
2635
|
+
{
|
|
2636
|
+
"type": "SEQ",
|
|
2637
|
+
"members": [
|
|
2638
|
+
{
|
|
2639
|
+
"type": "SYMBOL",
|
|
2640
|
+
"name": "_type_ref"
|
|
2641
|
+
},
|
|
2642
|
+
{
|
|
2643
|
+
"type": "REPEAT",
|
|
2644
|
+
"content": {
|
|
2645
|
+
"type": "SEQ",
|
|
2646
|
+
"members": [
|
|
2647
|
+
{
|
|
2648
|
+
"type": "STRING",
|
|
2649
|
+
"value": ","
|
|
2650
|
+
},
|
|
2651
|
+
{
|
|
2652
|
+
"type": "SYMBOL",
|
|
2653
|
+
"name": "_type_ref"
|
|
2654
|
+
}
|
|
2655
|
+
]
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
]
|
|
2659
|
+
},
|
|
2660
|
+
{
|
|
2661
|
+
"type": "STRING",
|
|
2662
|
+
"value": "]"
|
|
2663
|
+
}
|
|
2664
|
+
]
|
|
2592
2665
|
},
|
|
2593
2666
|
{
|
|
2594
2667
|
"type": "BLANK"
|
|
2595
2668
|
}
|
|
2596
2669
|
]
|
|
2597
|
-
}
|
|
2670
|
+
}
|
|
2671
|
+
]
|
|
2672
|
+
},
|
|
2673
|
+
"store_annotation": {
|
|
2674
|
+
"type": "SEQ",
|
|
2675
|
+
"members": [
|
|
2598
2676
|
{
|
|
2599
2677
|
"type": "STRING",
|
|
2600
|
-
"value": "
|
|
2678
|
+
"value": "@"
|
|
2679
|
+
},
|
|
2680
|
+
{
|
|
2681
|
+
"type": "FIELD",
|
|
2682
|
+
"name": "name",
|
|
2683
|
+
"content": {
|
|
2684
|
+
"type": "SYMBOL",
|
|
2685
|
+
"name": "identifier"
|
|
2686
|
+
}
|
|
2687
|
+
},
|
|
2688
|
+
{
|
|
2689
|
+
"type": "CHOICE",
|
|
2690
|
+
"members": [
|
|
2691
|
+
{
|
|
2692
|
+
"type": "SEQ",
|
|
2693
|
+
"members": [
|
|
2694
|
+
{
|
|
2695
|
+
"type": "STRING",
|
|
2696
|
+
"value": "("
|
|
2697
|
+
},
|
|
2698
|
+
{
|
|
2699
|
+
"type": "CHOICE",
|
|
2700
|
+
"members": [
|
|
2701
|
+
{
|
|
2702
|
+
"type": "SEQ",
|
|
2703
|
+
"members": [
|
|
2704
|
+
{
|
|
2705
|
+
"type": "SYMBOL",
|
|
2706
|
+
"name": "annotation_arg"
|
|
2707
|
+
},
|
|
2708
|
+
{
|
|
2709
|
+
"type": "REPEAT",
|
|
2710
|
+
"content": {
|
|
2711
|
+
"type": "SEQ",
|
|
2712
|
+
"members": [
|
|
2713
|
+
{
|
|
2714
|
+
"type": "STRING",
|
|
2715
|
+
"value": ","
|
|
2716
|
+
},
|
|
2717
|
+
{
|
|
2718
|
+
"type": "SYMBOL",
|
|
2719
|
+
"name": "annotation_arg"
|
|
2720
|
+
}
|
|
2721
|
+
]
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
]
|
|
2725
|
+
},
|
|
2726
|
+
{
|
|
2727
|
+
"type": "BLANK"
|
|
2728
|
+
}
|
|
2729
|
+
]
|
|
2730
|
+
},
|
|
2731
|
+
{
|
|
2732
|
+
"type": "CHOICE",
|
|
2733
|
+
"members": [
|
|
2734
|
+
{
|
|
2735
|
+
"type": "STRING",
|
|
2736
|
+
"value": ","
|
|
2737
|
+
},
|
|
2738
|
+
{
|
|
2739
|
+
"type": "BLANK"
|
|
2740
|
+
}
|
|
2741
|
+
]
|
|
2742
|
+
},
|
|
2743
|
+
{
|
|
2744
|
+
"type": "STRING",
|
|
2745
|
+
"value": ")"
|
|
2746
|
+
}
|
|
2747
|
+
]
|
|
2748
|
+
},
|
|
2749
|
+
{
|
|
2750
|
+
"type": "BLANK"
|
|
2751
|
+
}
|
|
2752
|
+
]
|
|
2753
|
+
}
|
|
2754
|
+
]
|
|
2755
|
+
},
|
|
2756
|
+
"annotation_arg": {
|
|
2757
|
+
"type": "SEQ",
|
|
2758
|
+
"members": [
|
|
2759
|
+
{
|
|
2760
|
+
"type": "CHOICE",
|
|
2761
|
+
"members": [
|
|
2762
|
+
{
|
|
2763
|
+
"type": "SEQ",
|
|
2764
|
+
"members": [
|
|
2765
|
+
{
|
|
2766
|
+
"type": "FIELD",
|
|
2767
|
+
"name": "label",
|
|
2768
|
+
"content": {
|
|
2769
|
+
"type": "SYMBOL",
|
|
2770
|
+
"name": "identifier"
|
|
2771
|
+
}
|
|
2772
|
+
},
|
|
2773
|
+
{
|
|
2774
|
+
"type": "STRING",
|
|
2775
|
+
"value": ":"
|
|
2776
|
+
}
|
|
2777
|
+
]
|
|
2778
|
+
},
|
|
2779
|
+
{
|
|
2780
|
+
"type": "BLANK"
|
|
2781
|
+
}
|
|
2782
|
+
]
|
|
2783
|
+
},
|
|
2784
|
+
{
|
|
2785
|
+
"type": "FIELD",
|
|
2786
|
+
"name": "value",
|
|
2787
|
+
"content": {
|
|
2788
|
+
"type": "SYMBOL",
|
|
2789
|
+
"name": "_expression"
|
|
2790
|
+
}
|
|
2601
2791
|
}
|
|
2602
2792
|
]
|
|
2603
2793
|
},
|
|
@@ -3619,7 +3809,7 @@
|
|
|
3619
3809
|
},
|
|
3620
3810
|
{
|
|
3621
3811
|
"type": "SYMBOL",
|
|
3622
|
-
"name": "
|
|
3812
|
+
"name": "assign_stmt"
|
|
3623
3813
|
},
|
|
3624
3814
|
{
|
|
3625
3815
|
"type": "PREC",
|
|
@@ -3756,12 +3946,20 @@
|
|
|
3756
3946
|
}
|
|
3757
3947
|
]
|
|
3758
3948
|
},
|
|
3759
|
-
"
|
|
3949
|
+
"assign_stmt": {
|
|
3760
3950
|
"type": "SEQ",
|
|
3761
3951
|
"members": [
|
|
3952
|
+
{
|
|
3953
|
+
"type": "FIELD",
|
|
3954
|
+
"name": "target",
|
|
3955
|
+
"content": {
|
|
3956
|
+
"type": "SYMBOL",
|
|
3957
|
+
"name": "identifier"
|
|
3958
|
+
}
|
|
3959
|
+
},
|
|
3762
3960
|
{
|
|
3763
3961
|
"type": "STRING",
|
|
3764
|
-
"value": "
|
|
3962
|
+
"value": ":="
|
|
3765
3963
|
},
|
|
3766
3964
|
{
|
|
3767
3965
|
"type": "FIELD",
|