tree-sitter-bynk 0.492.1 → 0.504.3
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 +46 -1
- package/package.json +1 -1
- package/queries/highlights.scm +8 -0
- package/src/grammar.json +172 -0
- package/src/node-types.json +393 -0
- package/src/parser.c +135431 -85583
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
|
),
|
|
@@ -470,6 +472,16 @@ module.exports = grammar({
|
|
|
470
472
|
field("path", $.string_literal),
|
|
471
473
|
),
|
|
472
474
|
|
|
475
|
+
// #2841: `fixture name = "fixtures/…"` in a suite body — a project file's
|
|
476
|
+
// text as a `String` constant for the suite's cases. Contextual `fixture`.
|
|
477
|
+
fixture_decl: ($) =>
|
|
478
|
+
seq(
|
|
479
|
+
"fixture",
|
|
480
|
+
field("name", $.identifier),
|
|
481
|
+
"=",
|
|
482
|
+
field("path", $.string_literal),
|
|
483
|
+
),
|
|
484
|
+
|
|
473
485
|
// #2617 (named constants): `const Name: Type = <static expression>` — a
|
|
474
486
|
// named value. Admitted in every body like `embed`; placement
|
|
475
487
|
// (`bynk.resolve.const_outside_context_or_commons`), the name's case
|
|
@@ -561,6 +573,7 @@ module.exports = grammar({
|
|
|
561
573
|
"NonNegative",
|
|
562
574
|
"Positive",
|
|
563
575
|
"NonEmpty",
|
|
576
|
+
"IsoDate",
|
|
564
577
|
),
|
|
565
578
|
// v0.21/v0.142 (ADR 0166): a refinement-bound number may be negated —
|
|
566
579
|
// `InRange(-1_000, 1_000_000)` — mirroring `parse_signed_num_literal`'s
|
|
@@ -700,6 +713,8 @@ module.exports = grammar({
|
|
|
700
713
|
")",
|
|
701
714
|
"->",
|
|
702
715
|
field("return_type", $._type_ref),
|
|
716
|
+
// #2868: a context function's capabilities, after the return type.
|
|
717
|
+
optional(field("given", $.given_clause)),
|
|
703
718
|
// Constrained generics slice 0: a method's `where A: Eq` clause bounds
|
|
704
719
|
// a receiver type's parameter.
|
|
705
720
|
optional($.where_clause),
|
|
@@ -841,6 +856,9 @@ module.exports = grammar({
|
|
|
841
856
|
// v0.142 (ADR 0166): the optional `limits { }` policy, likewise a
|
|
842
857
|
// header-position `from http` concern restricted by the checker.
|
|
843
858
|
optional(field("limits", $.limits_policy)),
|
|
859
|
+
// #2858: the optional `json { }` policy, likewise a header-position
|
|
860
|
+
// `from http` concern restricted by the checker.
|
|
861
|
+
optional(field("json", $.json_policy)),
|
|
844
862
|
// v0.140 (ADR 0163): a handler may carry one or more `@name(args)`
|
|
845
863
|
// annotations (`@cache(maxAge: 5.minutes)`, `@limit(maxBody: …)`) —
|
|
846
864
|
// the same shape `store_annotation` already gives store fields.
|
|
@@ -883,6 +901,18 @@ module.exports = grammar({
|
|
|
883
901
|
),
|
|
884
902
|
limits_field: ($) =>
|
|
885
903
|
seq(field("name", $.identifier), ":", field("value", $._expression)),
|
|
904
|
+
// #2858: `json { <name>: <value>, … }`. `json` is a contextual keyword (like
|
|
905
|
+
// `limits`); the one field name, `options`, is an ordinary identifier matched
|
|
906
|
+
// by the checker.
|
|
907
|
+
json_policy: ($) =>
|
|
908
|
+
seq(
|
|
909
|
+
"json",
|
|
910
|
+
"{",
|
|
911
|
+
repeat(seq($.json_field, optional(","))),
|
|
912
|
+
"}",
|
|
913
|
+
),
|
|
914
|
+
json_field: ($) =>
|
|
915
|
+
seq(field("name", $.identifier), ":", field("value", $._expression)),
|
|
886
916
|
// v0.44: `from <protocol>` on the service header.
|
|
887
917
|
// v0.103: `from websocket(in: I, out: O)` binds the inbound/outbound frame
|
|
888
918
|
// types. `websocket`, `in`, and `out` are contextual (resolved by `word`).
|
|
@@ -1621,7 +1651,10 @@ module.exports = grammar({
|
|
|
1621
1651
|
PREC.expect,
|
|
1622
1652
|
seq(
|
|
1623
1653
|
"expect",
|
|
1624
|
-
field(
|
|
1654
|
+
field(
|
|
1655
|
+
"cond",
|
|
1656
|
+
choice($.observation_expr, $.faults_expr, $.snapshot_expr, $._expression),
|
|
1657
|
+
),
|
|
1625
1658
|
),
|
|
1626
1659
|
),
|
|
1627
1660
|
|
|
@@ -1638,6 +1671,18 @@ module.exports = grammar({
|
|
|
1638
1671
|
"faults",
|
|
1639
1672
|
),
|
|
1640
1673
|
|
|
1674
|
+
// #2842: a snapshot claim — `expect <value> matches snapshot "<name>"`
|
|
1675
|
+
// compares the value's canonical JSON with a stored snapshot. `matches` and
|
|
1676
|
+
// `snapshot` are contextual, as `faults` is: an expression is never followed
|
|
1677
|
+
// by a bare identifier, so the words alone decide.
|
|
1678
|
+
snapshot_expr: ($) =>
|
|
1679
|
+
seq(
|
|
1680
|
+
field("value", $._expression),
|
|
1681
|
+
"matches",
|
|
1682
|
+
"snapshot",
|
|
1683
|
+
field("name", $.string_literal),
|
|
1684
|
+
),
|
|
1685
|
+
|
|
1641
1686
|
// v0.117: an observation — a `Cap.op` seam reference followed by one of the
|
|
1642
1687
|
// sugar matchers. `called` / `never` / `once` / `times` / `with` / `before`
|
|
1643
1688
|
// are contextual (state-lexed as keywords only here; ordinary identifiers
|
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)
|
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"
|
|
@@ -1693,6 +1701,35 @@
|
|
|
1693
1701
|
}
|
|
1694
1702
|
]
|
|
1695
1703
|
},
|
|
1704
|
+
"fixture_decl": {
|
|
1705
|
+
"type": "SEQ",
|
|
1706
|
+
"members": [
|
|
1707
|
+
{
|
|
1708
|
+
"type": "STRING",
|
|
1709
|
+
"value": "fixture"
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
"type": "FIELD",
|
|
1713
|
+
"name": "name",
|
|
1714
|
+
"content": {
|
|
1715
|
+
"type": "SYMBOL",
|
|
1716
|
+
"name": "identifier"
|
|
1717
|
+
}
|
|
1718
|
+
},
|
|
1719
|
+
{
|
|
1720
|
+
"type": "STRING",
|
|
1721
|
+
"value": "="
|
|
1722
|
+
},
|
|
1723
|
+
{
|
|
1724
|
+
"type": "FIELD",
|
|
1725
|
+
"name": "path",
|
|
1726
|
+
"content": {
|
|
1727
|
+
"type": "SYMBOL",
|
|
1728
|
+
"name": "string_literal"
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
]
|
|
1732
|
+
},
|
|
1696
1733
|
"const_decl": {
|
|
1697
1734
|
"type": "SEQ",
|
|
1698
1735
|
"members": [
|
|
@@ -2158,6 +2195,10 @@
|
|
|
2158
2195
|
{
|
|
2159
2196
|
"type": "STRING",
|
|
2160
2197
|
"value": "NonEmpty"
|
|
2198
|
+
},
|
|
2199
|
+
{
|
|
2200
|
+
"type": "STRING",
|
|
2201
|
+
"value": "IsoDate"
|
|
2161
2202
|
}
|
|
2162
2203
|
]
|
|
2163
2204
|
},
|
|
@@ -2784,6 +2825,22 @@
|
|
|
2784
2825
|
"name": "_type_ref"
|
|
2785
2826
|
}
|
|
2786
2827
|
},
|
|
2828
|
+
{
|
|
2829
|
+
"type": "CHOICE",
|
|
2830
|
+
"members": [
|
|
2831
|
+
{
|
|
2832
|
+
"type": "FIELD",
|
|
2833
|
+
"name": "given",
|
|
2834
|
+
"content": {
|
|
2835
|
+
"type": "SYMBOL",
|
|
2836
|
+
"name": "given_clause"
|
|
2837
|
+
}
|
|
2838
|
+
},
|
|
2839
|
+
{
|
|
2840
|
+
"type": "BLANK"
|
|
2841
|
+
}
|
|
2842
|
+
]
|
|
2843
|
+
},
|
|
2787
2844
|
{
|
|
2788
2845
|
"type": "CHOICE",
|
|
2789
2846
|
"members": [
|
|
@@ -3558,6 +3615,22 @@
|
|
|
3558
3615
|
}
|
|
3559
3616
|
]
|
|
3560
3617
|
},
|
|
3618
|
+
{
|
|
3619
|
+
"type": "CHOICE",
|
|
3620
|
+
"members": [
|
|
3621
|
+
{
|
|
3622
|
+
"type": "FIELD",
|
|
3623
|
+
"name": "json",
|
|
3624
|
+
"content": {
|
|
3625
|
+
"type": "SYMBOL",
|
|
3626
|
+
"name": "json_policy"
|
|
3627
|
+
}
|
|
3628
|
+
},
|
|
3629
|
+
{
|
|
3630
|
+
"type": "BLANK"
|
|
3631
|
+
}
|
|
3632
|
+
]
|
|
3633
|
+
},
|
|
3561
3634
|
{
|
|
3562
3635
|
"type": "REPEAT",
|
|
3563
3636
|
"content": {
|
|
@@ -3785,6 +3858,72 @@
|
|
|
3785
3858
|
}
|
|
3786
3859
|
]
|
|
3787
3860
|
},
|
|
3861
|
+
"json_policy": {
|
|
3862
|
+
"type": "SEQ",
|
|
3863
|
+
"members": [
|
|
3864
|
+
{
|
|
3865
|
+
"type": "STRING",
|
|
3866
|
+
"value": "json"
|
|
3867
|
+
},
|
|
3868
|
+
{
|
|
3869
|
+
"type": "STRING",
|
|
3870
|
+
"value": "{"
|
|
3871
|
+
},
|
|
3872
|
+
{
|
|
3873
|
+
"type": "REPEAT",
|
|
3874
|
+
"content": {
|
|
3875
|
+
"type": "SEQ",
|
|
3876
|
+
"members": [
|
|
3877
|
+
{
|
|
3878
|
+
"type": "SYMBOL",
|
|
3879
|
+
"name": "json_field"
|
|
3880
|
+
},
|
|
3881
|
+
{
|
|
3882
|
+
"type": "CHOICE",
|
|
3883
|
+
"members": [
|
|
3884
|
+
{
|
|
3885
|
+
"type": "STRING",
|
|
3886
|
+
"value": ","
|
|
3887
|
+
},
|
|
3888
|
+
{
|
|
3889
|
+
"type": "BLANK"
|
|
3890
|
+
}
|
|
3891
|
+
]
|
|
3892
|
+
}
|
|
3893
|
+
]
|
|
3894
|
+
}
|
|
3895
|
+
},
|
|
3896
|
+
{
|
|
3897
|
+
"type": "STRING",
|
|
3898
|
+
"value": "}"
|
|
3899
|
+
}
|
|
3900
|
+
]
|
|
3901
|
+
},
|
|
3902
|
+
"json_field": {
|
|
3903
|
+
"type": "SEQ",
|
|
3904
|
+
"members": [
|
|
3905
|
+
{
|
|
3906
|
+
"type": "FIELD",
|
|
3907
|
+
"name": "name",
|
|
3908
|
+
"content": {
|
|
3909
|
+
"type": "SYMBOL",
|
|
3910
|
+
"name": "identifier"
|
|
3911
|
+
}
|
|
3912
|
+
},
|
|
3913
|
+
{
|
|
3914
|
+
"type": "STRING",
|
|
3915
|
+
"value": ":"
|
|
3916
|
+
},
|
|
3917
|
+
{
|
|
3918
|
+
"type": "FIELD",
|
|
3919
|
+
"name": "value",
|
|
3920
|
+
"content": {
|
|
3921
|
+
"type": "SYMBOL",
|
|
3922
|
+
"name": "_expression"
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
]
|
|
3926
|
+
},
|
|
3788
3927
|
"service_protocol": {
|
|
3789
3928
|
"type": "SEQ",
|
|
3790
3929
|
"members": [
|
|
@@ -7667,6 +7806,10 @@
|
|
|
7667
7806
|
"type": "SYMBOL",
|
|
7668
7807
|
"name": "faults_expr"
|
|
7669
7808
|
},
|
|
7809
|
+
{
|
|
7810
|
+
"type": "SYMBOL",
|
|
7811
|
+
"name": "snapshot_expr"
|
|
7812
|
+
},
|
|
7670
7813
|
{
|
|
7671
7814
|
"type": "SYMBOL",
|
|
7672
7815
|
"name": "_expression"
|
|
@@ -7710,6 +7853,35 @@
|
|
|
7710
7853
|
}
|
|
7711
7854
|
]
|
|
7712
7855
|
},
|
|
7856
|
+
"snapshot_expr": {
|
|
7857
|
+
"type": "SEQ",
|
|
7858
|
+
"members": [
|
|
7859
|
+
{
|
|
7860
|
+
"type": "FIELD",
|
|
7861
|
+
"name": "value",
|
|
7862
|
+
"content": {
|
|
7863
|
+
"type": "SYMBOL",
|
|
7864
|
+
"name": "_expression"
|
|
7865
|
+
}
|
|
7866
|
+
},
|
|
7867
|
+
{
|
|
7868
|
+
"type": "STRING",
|
|
7869
|
+
"value": "matches"
|
|
7870
|
+
},
|
|
7871
|
+
{
|
|
7872
|
+
"type": "STRING",
|
|
7873
|
+
"value": "snapshot"
|
|
7874
|
+
},
|
|
7875
|
+
{
|
|
7876
|
+
"type": "FIELD",
|
|
7877
|
+
"name": "name",
|
|
7878
|
+
"content": {
|
|
7879
|
+
"type": "SYMBOL",
|
|
7880
|
+
"name": "string_literal"
|
|
7881
|
+
}
|
|
7882
|
+
}
|
|
7883
|
+
]
|
|
7884
|
+
},
|
|
7713
7885
|
"observation_expr": {
|
|
7714
7886
|
"type": "SEQ",
|
|
7715
7887
|
"members": [
|