tree-sitter-bynk 0.492.1 → 0.508.4
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 +62 -3
- package/package.json +1 -1
- package/queries/highlights.scm +10 -0
- package/src/grammar.json +223 -12
- package/src/node-types.json +427 -4
- package/src/parser.c +135063 -85163
package/grammar.js
CHANGED
|
@@ -270,6 +270,8 @@ module.exports = grammar({
|
|
|
270
270
|
$.consumes_decl,
|
|
271
271
|
$.env_clause,
|
|
272
272
|
$.stub_clause,
|
|
273
|
+
$.fixture_decl,
|
|
274
|
+
$.fn_decl,
|
|
273
275
|
$.case,
|
|
274
276
|
$.property_decl,
|
|
275
277
|
),
|
|
@@ -286,9 +288,12 @@ module.exports = grammar({
|
|
|
286
288
|
// v0.6: `consumes a.b as Alias`.
|
|
287
289
|
seq("as", field("alias", $.identifier)),
|
|
288
290
|
// v0.17: `consumes a.b { Cap, … }` — selected capabilities.
|
|
291
|
+
// #2887: an exported type may be renamed, `T as Alias`.
|
|
289
292
|
seq(
|
|
290
293
|
"{",
|
|
291
|
-
optional(
|
|
294
|
+
optional(
|
|
295
|
+
sep1($.consumes_item, ","),
|
|
296
|
+
),
|
|
292
297
|
optional(","),
|
|
293
298
|
"}",
|
|
294
299
|
),
|
|
@@ -296,6 +301,14 @@ module.exports = grammar({
|
|
|
296
301
|
),
|
|
297
302
|
),
|
|
298
303
|
|
|
304
|
+
// #2890: one braced item of a selective `consumes`: a name, optionally
|
|
305
|
+
// renamed with `as`.
|
|
306
|
+
consumes_item: ($) =>
|
|
307
|
+
seq(
|
|
308
|
+
field("name", $.identifier),
|
|
309
|
+
optional(seq("as", field("alias", $.identifier))),
|
|
310
|
+
),
|
|
311
|
+
|
|
299
312
|
// v0.17: an adapter's binding module + optional npm dependency map.
|
|
300
313
|
binding_decl: ($) =>
|
|
301
314
|
seq(
|
|
@@ -470,6 +483,16 @@ module.exports = grammar({
|
|
|
470
483
|
field("path", $.string_literal),
|
|
471
484
|
),
|
|
472
485
|
|
|
486
|
+
// #2841: `fixture name = "fixtures/…"` in a suite body — a project file's
|
|
487
|
+
// text as a `String` constant for the suite's cases. Contextual `fixture`.
|
|
488
|
+
fixture_decl: ($) =>
|
|
489
|
+
seq(
|
|
490
|
+
"fixture",
|
|
491
|
+
field("name", $.identifier),
|
|
492
|
+
"=",
|
|
493
|
+
field("path", $.string_literal),
|
|
494
|
+
),
|
|
495
|
+
|
|
473
496
|
// #2617 (named constants): `const Name: Type = <static expression>` — a
|
|
474
497
|
// named value. Admitted in every body like `embed`; placement
|
|
475
498
|
// (`bynk.resolve.const_outside_context_or_commons`), the name's case
|
|
@@ -561,6 +584,7 @@ module.exports = grammar({
|
|
|
561
584
|
"NonNegative",
|
|
562
585
|
"Positive",
|
|
563
586
|
"NonEmpty",
|
|
587
|
+
"IsoDate",
|
|
564
588
|
),
|
|
565
589
|
// v0.21/v0.142 (ADR 0166): a refinement-bound number may be negated —
|
|
566
590
|
// `InRange(-1_000, 1_000_000)` — mirroring `parse_signed_num_literal`'s
|
|
@@ -700,6 +724,8 @@ module.exports = grammar({
|
|
|
700
724
|
")",
|
|
701
725
|
"->",
|
|
702
726
|
field("return_type", $._type_ref),
|
|
727
|
+
// #2868: a context function's capabilities, after the return type.
|
|
728
|
+
optional(field("given", $.given_clause)),
|
|
703
729
|
// Constrained generics slice 0: a method's `where A: Eq` clause bounds
|
|
704
730
|
// a receiver type's parameter.
|
|
705
731
|
optional($.where_clause),
|
|
@@ -841,6 +867,9 @@ module.exports = grammar({
|
|
|
841
867
|
// v0.142 (ADR 0166): the optional `limits { }` policy, likewise a
|
|
842
868
|
// header-position `from http` concern restricted by the checker.
|
|
843
869
|
optional(field("limits", $.limits_policy)),
|
|
870
|
+
// #2858: the optional `json { }` policy, likewise a header-position
|
|
871
|
+
// `from http` concern restricted by the checker.
|
|
872
|
+
optional(field("json", $.json_policy)),
|
|
844
873
|
// v0.140 (ADR 0163): a handler may carry one or more `@name(args)`
|
|
845
874
|
// annotations (`@cache(maxAge: 5.minutes)`, `@limit(maxBody: …)`) —
|
|
846
875
|
// the same shape `store_annotation` already gives store fields.
|
|
@@ -883,6 +912,18 @@ module.exports = grammar({
|
|
|
883
912
|
),
|
|
884
913
|
limits_field: ($) =>
|
|
885
914
|
seq(field("name", $.identifier), ":", field("value", $._expression)),
|
|
915
|
+
// #2858: `json { <name>: <value>, … }`. `json` is a contextual keyword (like
|
|
916
|
+
// `limits`); the one field name, `options`, is an ordinary identifier matched
|
|
917
|
+
// by the checker.
|
|
918
|
+
json_policy: ($) =>
|
|
919
|
+
seq(
|
|
920
|
+
"json",
|
|
921
|
+
"{",
|
|
922
|
+
repeat(seq($.json_field, optional(","))),
|
|
923
|
+
"}",
|
|
924
|
+
),
|
|
925
|
+
json_field: ($) =>
|
|
926
|
+
seq(field("name", $.identifier), ":", field("value", $._expression)),
|
|
886
927
|
// v0.44: `from <protocol>` on the service header.
|
|
887
928
|
// v0.103: `from websocket(in: I, out: O)` binds the inbound/outbound frame
|
|
888
929
|
// types. `websocket`, `in`, and `out` are contextual (resolved by `word`).
|
|
@@ -1621,7 +1662,10 @@ module.exports = grammar({
|
|
|
1621
1662
|
PREC.expect,
|
|
1622
1663
|
seq(
|
|
1623
1664
|
"expect",
|
|
1624
|
-
field(
|
|
1665
|
+
field(
|
|
1666
|
+
"cond",
|
|
1667
|
+
choice($.observation_expr, $.faults_expr, $.snapshot_expr, $._expression),
|
|
1668
|
+
),
|
|
1625
1669
|
),
|
|
1626
1670
|
),
|
|
1627
1671
|
|
|
@@ -1638,6 +1682,18 @@ module.exports = grammar({
|
|
|
1638
1682
|
"faults",
|
|
1639
1683
|
),
|
|
1640
1684
|
|
|
1685
|
+
// #2842: a snapshot claim — `expect <value> matches snapshot "<name>"`
|
|
1686
|
+
// compares the value's canonical JSON with a stored snapshot. `matches` and
|
|
1687
|
+
// `snapshot` are contextual, as `faults` is: an expression is never followed
|
|
1688
|
+
// by a bare identifier, so the words alone decide.
|
|
1689
|
+
snapshot_expr: ($) =>
|
|
1690
|
+
seq(
|
|
1691
|
+
field("value", $._expression),
|
|
1692
|
+
"matches",
|
|
1693
|
+
"snapshot",
|
|
1694
|
+
field("name", $.string_literal),
|
|
1695
|
+
),
|
|
1696
|
+
|
|
1641
1697
|
// v0.117: an observation — a `Cap.op` seam reference followed by one of the
|
|
1642
1698
|
// sugar matchers. `called` / `never` / `once` / `times` / `with` / `before`
|
|
1643
1699
|
// are contextual (state-lexed as keywords only here; ordinary identifiers
|
|
@@ -1959,7 +2015,10 @@ module.exports = grammar({
|
|
|
1959
2015
|
lambda_param: ($) =>
|
|
1960
2016
|
choice(
|
|
1961
2017
|
seq(
|
|
1962
|
-
field(
|
|
2018
|
+
field(
|
|
2019
|
+
"name",
|
|
2020
|
+
choice($.identifier, $._contextual_identifier, alias("_", $.wildcard)),
|
|
2021
|
+
),
|
|
1963
2022
|
optional(seq(":", field("type", $._type_ref))),
|
|
1964
2023
|
),
|
|
1965
2024
|
field("pattern", alias($._lambda_record_pattern, $.record_pattern)),
|
package/package.json
CHANGED
package/queries/highlights.scm
CHANGED
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"cors"
|
|
47
47
|
"security"
|
|
48
48
|
"limits"
|
|
49
|
+
"json"
|
|
49
50
|
"exports"
|
|
50
51
|
"key"
|
|
51
52
|
"suite"
|
|
@@ -112,10 +113,17 @@
|
|
|
112
113
|
; #2134: the contextual `env` word heading a suite/case `env { … }` clause.
|
|
113
114
|
"env" @keyword
|
|
114
115
|
|
|
116
|
+
; #2841: the contextual `fixture` word heading a suite `fixture` declaration.
|
|
117
|
+
"fixture" @keyword
|
|
118
|
+
|
|
115
119
|
; #1706: the fault-claim word — contextual, like the observation words: the
|
|
116
120
|
; token exists only inside a `faults_expr`.
|
|
117
121
|
"faults" @keyword.operator
|
|
118
122
|
|
|
123
|
+
; #2842: the snapshot claim's words — contextual, like `faults`: the tokens exist
|
|
124
|
+
; only inside a `snapshot_expr`.
|
|
125
|
+
(snapshot_expr ["matches" "snapshot"] @keyword.operator)
|
|
126
|
+
|
|
119
127
|
; #2640: `par` is contextual (an identifier elsewhere), so it is a keyword only
|
|
120
128
|
; as the head of a `par_stmt`.
|
|
121
129
|
(par_stmt "par" @keyword)
|
|
@@ -243,6 +251,8 @@
|
|
|
243
251
|
(qualified_name (identifier) @module)
|
|
244
252
|
(uses_decl target: (qualified_name) @module)
|
|
245
253
|
(consumes_decl target: (qualified_name) @module)
|
|
254
|
+
; #2890: the name a `consumes U { T as Alias }` item introduces is a type.
|
|
255
|
+
(consumes_item alias: (identifier) @type)
|
|
246
256
|
(suite_decl target: (qualified_name) @module)
|
|
247
257
|
|
|
248
258
|
; -- Operators & punctuation --
|
package/src/grammar.json
CHANGED
|
@@ -582,6 +582,14 @@
|
|
|
582
582
|
"type": "SYMBOL",
|
|
583
583
|
"name": "stub_clause"
|
|
584
584
|
},
|
|
585
|
+
{
|
|
586
|
+
"type": "SYMBOL",
|
|
587
|
+
"name": "fixture_decl"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"type": "SYMBOL",
|
|
591
|
+
"name": "fn_decl"
|
|
592
|
+
},
|
|
585
593
|
{
|
|
586
594
|
"type": "SYMBOL",
|
|
587
595
|
"name": "case"
|
|
@@ -661,12 +669,8 @@
|
|
|
661
669
|
"type": "SEQ",
|
|
662
670
|
"members": [
|
|
663
671
|
{
|
|
664
|
-
"type": "
|
|
665
|
-
"name": "
|
|
666
|
-
"content": {
|
|
667
|
-
"type": "SYMBOL",
|
|
668
|
-
"name": "identifier"
|
|
669
|
-
}
|
|
672
|
+
"type": "SYMBOL",
|
|
673
|
+
"name": "consumes_item"
|
|
670
674
|
},
|
|
671
675
|
{
|
|
672
676
|
"type": "REPEAT",
|
|
@@ -678,12 +682,8 @@
|
|
|
678
682
|
"value": ","
|
|
679
683
|
},
|
|
680
684
|
{
|
|
681
|
-
"type": "
|
|
682
|
-
"name": "
|
|
683
|
-
"content": {
|
|
684
|
-
"type": "SYMBOL",
|
|
685
|
-
"name": "identifier"
|
|
686
|
-
}
|
|
685
|
+
"type": "SYMBOL",
|
|
686
|
+
"name": "consumes_item"
|
|
687
687
|
}
|
|
688
688
|
]
|
|
689
689
|
}
|
|
@@ -722,6 +722,44 @@
|
|
|
722
722
|
}
|
|
723
723
|
]
|
|
724
724
|
},
|
|
725
|
+
"consumes_item": {
|
|
726
|
+
"type": "SEQ",
|
|
727
|
+
"members": [
|
|
728
|
+
{
|
|
729
|
+
"type": "FIELD",
|
|
730
|
+
"name": "name",
|
|
731
|
+
"content": {
|
|
732
|
+
"type": "SYMBOL",
|
|
733
|
+
"name": "identifier"
|
|
734
|
+
}
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
"type": "CHOICE",
|
|
738
|
+
"members": [
|
|
739
|
+
{
|
|
740
|
+
"type": "SEQ",
|
|
741
|
+
"members": [
|
|
742
|
+
{
|
|
743
|
+
"type": "STRING",
|
|
744
|
+
"value": "as"
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
"type": "FIELD",
|
|
748
|
+
"name": "alias",
|
|
749
|
+
"content": {
|
|
750
|
+
"type": "SYMBOL",
|
|
751
|
+
"name": "identifier"
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
]
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"type": "BLANK"
|
|
758
|
+
}
|
|
759
|
+
]
|
|
760
|
+
}
|
|
761
|
+
]
|
|
762
|
+
},
|
|
725
763
|
"binding_decl": {
|
|
726
764
|
"type": "SEQ",
|
|
727
765
|
"members": [
|
|
@@ -1693,6 +1731,35 @@
|
|
|
1693
1731
|
}
|
|
1694
1732
|
]
|
|
1695
1733
|
},
|
|
1734
|
+
"fixture_decl": {
|
|
1735
|
+
"type": "SEQ",
|
|
1736
|
+
"members": [
|
|
1737
|
+
{
|
|
1738
|
+
"type": "STRING",
|
|
1739
|
+
"value": "fixture"
|
|
1740
|
+
},
|
|
1741
|
+
{
|
|
1742
|
+
"type": "FIELD",
|
|
1743
|
+
"name": "name",
|
|
1744
|
+
"content": {
|
|
1745
|
+
"type": "SYMBOL",
|
|
1746
|
+
"name": "identifier"
|
|
1747
|
+
}
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
"type": "STRING",
|
|
1751
|
+
"value": "="
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
"type": "FIELD",
|
|
1755
|
+
"name": "path",
|
|
1756
|
+
"content": {
|
|
1757
|
+
"type": "SYMBOL",
|
|
1758
|
+
"name": "string_literal"
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
]
|
|
1762
|
+
},
|
|
1696
1763
|
"const_decl": {
|
|
1697
1764
|
"type": "SEQ",
|
|
1698
1765
|
"members": [
|
|
@@ -2158,6 +2225,10 @@
|
|
|
2158
2225
|
{
|
|
2159
2226
|
"type": "STRING",
|
|
2160
2227
|
"value": "NonEmpty"
|
|
2228
|
+
},
|
|
2229
|
+
{
|
|
2230
|
+
"type": "STRING",
|
|
2231
|
+
"value": "IsoDate"
|
|
2161
2232
|
}
|
|
2162
2233
|
]
|
|
2163
2234
|
},
|
|
@@ -2784,6 +2855,22 @@
|
|
|
2784
2855
|
"name": "_type_ref"
|
|
2785
2856
|
}
|
|
2786
2857
|
},
|
|
2858
|
+
{
|
|
2859
|
+
"type": "CHOICE",
|
|
2860
|
+
"members": [
|
|
2861
|
+
{
|
|
2862
|
+
"type": "FIELD",
|
|
2863
|
+
"name": "given",
|
|
2864
|
+
"content": {
|
|
2865
|
+
"type": "SYMBOL",
|
|
2866
|
+
"name": "given_clause"
|
|
2867
|
+
}
|
|
2868
|
+
},
|
|
2869
|
+
{
|
|
2870
|
+
"type": "BLANK"
|
|
2871
|
+
}
|
|
2872
|
+
]
|
|
2873
|
+
},
|
|
2787
2874
|
{
|
|
2788
2875
|
"type": "CHOICE",
|
|
2789
2876
|
"members": [
|
|
@@ -3558,6 +3645,22 @@
|
|
|
3558
3645
|
}
|
|
3559
3646
|
]
|
|
3560
3647
|
},
|
|
3648
|
+
{
|
|
3649
|
+
"type": "CHOICE",
|
|
3650
|
+
"members": [
|
|
3651
|
+
{
|
|
3652
|
+
"type": "FIELD",
|
|
3653
|
+
"name": "json",
|
|
3654
|
+
"content": {
|
|
3655
|
+
"type": "SYMBOL",
|
|
3656
|
+
"name": "json_policy"
|
|
3657
|
+
}
|
|
3658
|
+
},
|
|
3659
|
+
{
|
|
3660
|
+
"type": "BLANK"
|
|
3661
|
+
}
|
|
3662
|
+
]
|
|
3663
|
+
},
|
|
3561
3664
|
{
|
|
3562
3665
|
"type": "REPEAT",
|
|
3563
3666
|
"content": {
|
|
@@ -3785,6 +3888,72 @@
|
|
|
3785
3888
|
}
|
|
3786
3889
|
]
|
|
3787
3890
|
},
|
|
3891
|
+
"json_policy": {
|
|
3892
|
+
"type": "SEQ",
|
|
3893
|
+
"members": [
|
|
3894
|
+
{
|
|
3895
|
+
"type": "STRING",
|
|
3896
|
+
"value": "json"
|
|
3897
|
+
},
|
|
3898
|
+
{
|
|
3899
|
+
"type": "STRING",
|
|
3900
|
+
"value": "{"
|
|
3901
|
+
},
|
|
3902
|
+
{
|
|
3903
|
+
"type": "REPEAT",
|
|
3904
|
+
"content": {
|
|
3905
|
+
"type": "SEQ",
|
|
3906
|
+
"members": [
|
|
3907
|
+
{
|
|
3908
|
+
"type": "SYMBOL",
|
|
3909
|
+
"name": "json_field"
|
|
3910
|
+
},
|
|
3911
|
+
{
|
|
3912
|
+
"type": "CHOICE",
|
|
3913
|
+
"members": [
|
|
3914
|
+
{
|
|
3915
|
+
"type": "STRING",
|
|
3916
|
+
"value": ","
|
|
3917
|
+
},
|
|
3918
|
+
{
|
|
3919
|
+
"type": "BLANK"
|
|
3920
|
+
}
|
|
3921
|
+
]
|
|
3922
|
+
}
|
|
3923
|
+
]
|
|
3924
|
+
}
|
|
3925
|
+
},
|
|
3926
|
+
{
|
|
3927
|
+
"type": "STRING",
|
|
3928
|
+
"value": "}"
|
|
3929
|
+
}
|
|
3930
|
+
]
|
|
3931
|
+
},
|
|
3932
|
+
"json_field": {
|
|
3933
|
+
"type": "SEQ",
|
|
3934
|
+
"members": [
|
|
3935
|
+
{
|
|
3936
|
+
"type": "FIELD",
|
|
3937
|
+
"name": "name",
|
|
3938
|
+
"content": {
|
|
3939
|
+
"type": "SYMBOL",
|
|
3940
|
+
"name": "identifier"
|
|
3941
|
+
}
|
|
3942
|
+
},
|
|
3943
|
+
{
|
|
3944
|
+
"type": "STRING",
|
|
3945
|
+
"value": ":"
|
|
3946
|
+
},
|
|
3947
|
+
{
|
|
3948
|
+
"type": "FIELD",
|
|
3949
|
+
"name": "value",
|
|
3950
|
+
"content": {
|
|
3951
|
+
"type": "SYMBOL",
|
|
3952
|
+
"name": "_expression"
|
|
3953
|
+
}
|
|
3954
|
+
}
|
|
3955
|
+
]
|
|
3956
|
+
},
|
|
3788
3957
|
"service_protocol": {
|
|
3789
3958
|
"type": "SEQ",
|
|
3790
3959
|
"members": [
|
|
@@ -7667,6 +7836,10 @@
|
|
|
7667
7836
|
"type": "SYMBOL",
|
|
7668
7837
|
"name": "faults_expr"
|
|
7669
7838
|
},
|
|
7839
|
+
{
|
|
7840
|
+
"type": "SYMBOL",
|
|
7841
|
+
"name": "snapshot_expr"
|
|
7842
|
+
},
|
|
7670
7843
|
{
|
|
7671
7844
|
"type": "SYMBOL",
|
|
7672
7845
|
"name": "_expression"
|
|
@@ -7710,6 +7883,35 @@
|
|
|
7710
7883
|
}
|
|
7711
7884
|
]
|
|
7712
7885
|
},
|
|
7886
|
+
"snapshot_expr": {
|
|
7887
|
+
"type": "SEQ",
|
|
7888
|
+
"members": [
|
|
7889
|
+
{
|
|
7890
|
+
"type": "FIELD",
|
|
7891
|
+
"name": "value",
|
|
7892
|
+
"content": {
|
|
7893
|
+
"type": "SYMBOL",
|
|
7894
|
+
"name": "_expression"
|
|
7895
|
+
}
|
|
7896
|
+
},
|
|
7897
|
+
{
|
|
7898
|
+
"type": "STRING",
|
|
7899
|
+
"value": "matches"
|
|
7900
|
+
},
|
|
7901
|
+
{
|
|
7902
|
+
"type": "STRING",
|
|
7903
|
+
"value": "snapshot"
|
|
7904
|
+
},
|
|
7905
|
+
{
|
|
7906
|
+
"type": "FIELD",
|
|
7907
|
+
"name": "name",
|
|
7908
|
+
"content": {
|
|
7909
|
+
"type": "SYMBOL",
|
|
7910
|
+
"name": "string_literal"
|
|
7911
|
+
}
|
|
7912
|
+
}
|
|
7913
|
+
]
|
|
7914
|
+
},
|
|
7713
7915
|
"observation_expr": {
|
|
7714
7916
|
"type": "SEQ",
|
|
7715
7917
|
"members": [
|
|
@@ -9162,6 +9364,15 @@
|
|
|
9162
9364
|
{
|
|
9163
9365
|
"type": "SYMBOL",
|
|
9164
9366
|
"name": "_contextual_identifier"
|
|
9367
|
+
},
|
|
9368
|
+
{
|
|
9369
|
+
"type": "ALIAS",
|
|
9370
|
+
"content": {
|
|
9371
|
+
"type": "STRING",
|
|
9372
|
+
"value": "_"
|
|
9373
|
+
},
|
|
9374
|
+
"named": true,
|
|
9375
|
+
"value": "wildcard"
|
|
9165
9376
|
}
|
|
9166
9377
|
]
|
|
9167
9378
|
}
|