tree-sitter-bynk 0.163.0 → 0.208.2

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 CHANGED
@@ -412,7 +412,8 @@ module.exports = grammar({
412
412
  _pred_arg: ($) => choice($.number_literal, $.float_literal, $.string_literal),
413
413
 
414
414
  _base_type: ($) => $.base_type,
415
- base_type: () => choice("Int", "String", "Bool", "Float", "Duration", "Instant"),
415
+ base_type: () =>
416
+ choice("Int", "String", "Bool", "Float", "Duration", "Instant", "Bytes"),
416
417
 
417
418
  _type_ref: ($) =>
418
419
  choice(
@@ -461,31 +462,54 @@ module.exports = grammar({
461
462
 
462
463
  unit_type: () => seq("(", ")"),
463
464
  validation_error_type: () => "ValidationError",
465
+ // Each built-in generic has a fixed arity, which the compiler parser
466
+ // (`bynk-syntax`) enforces at parse time with a `bynk.parse.*` diagnostic.
467
+ // The production therefore states that arity directly — a unary built-in
468
+ // takes exactly one argument, a binary one exactly two — rather than
469
+ // over-generating with `sep1` and deferring. This keeps the grammar in
470
+ // agreement with the parser (see the cross-parser conformance test).
464
471
  generic_type_ref: ($) =>
465
- seq(
466
- field(
467
- "name",
468
- choice(
469
- alias("Result", $.builtin_type),
470
- alias("Option", $.builtin_type),
471
- alias("Effect", $.builtin_type),
472
- // v0.9: HTTP result type.
473
- alias("HttpResult", $.builtin_type),
474
- // v0.20b: the built-in collection types.
475
- alias("List", $.builtin_type),
476
- alias("Map", $.builtin_type),
477
- // v0.100/v0.92/v0.102: stream, lazy storage query, held connection.
478
- alias("Stream", $.builtin_type),
479
- alias("Query", $.builtin_type),
480
- alias("Connection", $.builtin_type),
481
- // v0.119 (testing track slice 7): `History[Agent]` — a generated,
482
- // driven call-history (test-only generator).
483
- alias("History", $.builtin_type),
472
+ choice(
473
+ // Unary built-ins — `Name[T]`.
474
+ seq(
475
+ field(
476
+ "name",
477
+ choice(
478
+ alias("Option", $.builtin_type),
479
+ alias("Effect", $.builtin_type),
480
+ // v0.9: HTTP result type.
481
+ alias("HttpResult", $.builtin_type),
482
+ // v0.20b: the built-in list collection.
483
+ alias("List", $.builtin_type),
484
+ // v0.100/v0.92/v0.102: stream, lazy storage query, held connection.
485
+ alias("Stream", $.builtin_type),
486
+ alias("Query", $.builtin_type),
487
+ alias("Connection", $.builtin_type),
488
+ // v0.119 (testing track slice 7): `History[Agent]` — a generated,
489
+ // driven call-history (test-only generator).
490
+ alias("History", $.builtin_type),
491
+ ),
484
492
  ),
493
+ "[",
494
+ field("arg", $._type_ref),
495
+ "]",
496
+ ),
497
+ // Binary built-ins — `Name[K, V]`.
498
+ seq(
499
+ field(
500
+ "name",
501
+ choice(
502
+ alias("Result", $.builtin_type),
503
+ // v0.20b: the built-in map collection.
504
+ alias("Map", $.builtin_type),
505
+ ),
506
+ ),
507
+ "[",
508
+ field("arg", $._type_ref),
509
+ ",",
510
+ field("arg", $._type_ref),
511
+ "]",
485
512
  ),
486
- "[",
487
- sep1(field("arg", $._type_ref), ","),
488
- "]",
489
513
  ),
490
514
 
491
515
  // -- Function declarations --
@@ -1044,6 +1068,22 @@ module.exports = grammar({
1044
1068
  optional(seq(":", field("type", $._type_ref))),
1045
1069
  "<-",
1046
1070
  field("value", $._expression),
1071
+ // v0.182 (#664): an optional call-site actor clause — the test-body form
1072
+ // `let x <- <service address> by <Actor>(<identity>)`. Distinct from
1073
+ // `by_clause` (the handler form): the identity is an argument, not a
1074
+ // binder, and there is no actor sum.
1075
+ optional(field("principal", $.call_site_actor)),
1076
+ ),
1077
+ // v0.182 (#664): `by <Actor>` (unit identity) or `by <Actor>(<identity>)`.
1078
+ // `prec.right` so an immediately-following `(` is taken as the identity
1079
+ // argument rather than starting a fresh token sequence.
1080
+ call_site_actor: ($) =>
1081
+ prec.right(
1082
+ seq(
1083
+ "by",
1084
+ field("actor", $.identifier),
1085
+ optional(seq("(", field("identity", $._expression), ")")),
1086
+ ),
1047
1087
  ),
1048
1088
  // v0.79: `~> expr` — an asynchronous fire-and-forget send (no binder).
1049
1089
  effect_send_stmt: ($) => seq("~>", field("value", $._expression)),
@@ -1244,6 +1284,7 @@ module.exports = grammar({
1244
1284
  $.none_expr,
1245
1285
  $.effect_pure_expr,
1246
1286
  $.val_expr,
1287
+ $.wire_expr,
1247
1288
  $.trace_expr,
1248
1289
  $.list_literal,
1249
1290
  $.block,
@@ -1391,6 +1432,12 @@ module.exports = grammar({
1391
1432
  seq("{", optional(sep1($.field_init, ",")), optional(","), "}"),
1392
1433
  ),
1393
1434
 
1435
+ // Slice C: `Wire(<String>)` — a raw, pre-validation argument to a
1436
+ // `system`-tier service address. `prec.right` resolves the `(` against an
1437
+ // ordinary call. The test-context and `system`-tier restrictions are
1438
+ // semantic, left to the checker.
1439
+ wire_expr: ($) => prec.right(seq("Wire", "(", field("input", $._expression), ")")),
1440
+
1394
1441
  self_expr: () => "self",
1395
1442
 
1396
1443
  // -- Tokens --
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tree-sitter-bynk",
3
- "version": "0.163.0",
3
+ "version": "0.208.2",
4
4
  "description": "Tree-sitter grammar for the Bynk DSL (v0–v0.16).",
5
5
  "main": "bindings/node",
6
6
  "types": "bindings/node",
package/src/grammar.json CHANGED
@@ -1640,6 +1640,10 @@
1640
1640
  {
1641
1641
  "type": "STRING",
1642
1642
  "value": "Instant"
1643
+ },
1644
+ {
1645
+ "type": "STRING",
1646
+ "value": "Bytes"
1643
1647
  }
1644
1648
  ]
1645
1649
  },
@@ -1852,114 +1856,96 @@
1852
1856
  "value": "ValidationError"
1853
1857
  },
1854
1858
  "generic_type_ref": {
1855
- "type": "SEQ",
1859
+ "type": "CHOICE",
1856
1860
  "members": [
1857
- {
1858
- "type": "FIELD",
1859
- "name": "name",
1860
- "content": {
1861
- "type": "CHOICE",
1862
- "members": [
1863
- {
1864
- "type": "ALIAS",
1865
- "content": {
1866
- "type": "STRING",
1867
- "value": "Result"
1868
- },
1869
- "named": true,
1870
- "value": "builtin_type"
1871
- },
1872
- {
1873
- "type": "ALIAS",
1874
- "content": {
1875
- "type": "STRING",
1876
- "value": "Option"
1877
- },
1878
- "named": true,
1879
- "value": "builtin_type"
1880
- },
1881
- {
1882
- "type": "ALIAS",
1883
- "content": {
1884
- "type": "STRING",
1885
- "value": "Effect"
1886
- },
1887
- "named": true,
1888
- "value": "builtin_type"
1889
- },
1890
- {
1891
- "type": "ALIAS",
1892
- "content": {
1893
- "type": "STRING",
1894
- "value": "HttpResult"
1895
- },
1896
- "named": true,
1897
- "value": "builtin_type"
1898
- },
1899
- {
1900
- "type": "ALIAS",
1901
- "content": {
1902
- "type": "STRING",
1903
- "value": "List"
1904
- },
1905
- "named": true,
1906
- "value": "builtin_type"
1907
- },
1908
- {
1909
- "type": "ALIAS",
1910
- "content": {
1911
- "type": "STRING",
1912
- "value": "Map"
1913
- },
1914
- "named": true,
1915
- "value": "builtin_type"
1916
- },
1917
- {
1918
- "type": "ALIAS",
1919
- "content": {
1920
- "type": "STRING",
1921
- "value": "Stream"
1922
- },
1923
- "named": true,
1924
- "value": "builtin_type"
1925
- },
1926
- {
1927
- "type": "ALIAS",
1928
- "content": {
1929
- "type": "STRING",
1930
- "value": "Query"
1931
- },
1932
- "named": true,
1933
- "value": "builtin_type"
1934
- },
1935
- {
1936
- "type": "ALIAS",
1937
- "content": {
1938
- "type": "STRING",
1939
- "value": "Connection"
1940
- },
1941
- "named": true,
1942
- "value": "builtin_type"
1943
- },
1944
- {
1945
- "type": "ALIAS",
1946
- "content": {
1947
- "type": "STRING",
1948
- "value": "History"
1949
- },
1950
- "named": true,
1951
- "value": "builtin_type"
1952
- }
1953
- ]
1954
- }
1955
- },
1956
- {
1957
- "type": "STRING",
1958
- "value": "["
1959
- },
1960
1861
  {
1961
1862
  "type": "SEQ",
1962
1863
  "members": [
1864
+ {
1865
+ "type": "FIELD",
1866
+ "name": "name",
1867
+ "content": {
1868
+ "type": "CHOICE",
1869
+ "members": [
1870
+ {
1871
+ "type": "ALIAS",
1872
+ "content": {
1873
+ "type": "STRING",
1874
+ "value": "Option"
1875
+ },
1876
+ "named": true,
1877
+ "value": "builtin_type"
1878
+ },
1879
+ {
1880
+ "type": "ALIAS",
1881
+ "content": {
1882
+ "type": "STRING",
1883
+ "value": "Effect"
1884
+ },
1885
+ "named": true,
1886
+ "value": "builtin_type"
1887
+ },
1888
+ {
1889
+ "type": "ALIAS",
1890
+ "content": {
1891
+ "type": "STRING",
1892
+ "value": "HttpResult"
1893
+ },
1894
+ "named": true,
1895
+ "value": "builtin_type"
1896
+ },
1897
+ {
1898
+ "type": "ALIAS",
1899
+ "content": {
1900
+ "type": "STRING",
1901
+ "value": "List"
1902
+ },
1903
+ "named": true,
1904
+ "value": "builtin_type"
1905
+ },
1906
+ {
1907
+ "type": "ALIAS",
1908
+ "content": {
1909
+ "type": "STRING",
1910
+ "value": "Stream"
1911
+ },
1912
+ "named": true,
1913
+ "value": "builtin_type"
1914
+ },
1915
+ {
1916
+ "type": "ALIAS",
1917
+ "content": {
1918
+ "type": "STRING",
1919
+ "value": "Query"
1920
+ },
1921
+ "named": true,
1922
+ "value": "builtin_type"
1923
+ },
1924
+ {
1925
+ "type": "ALIAS",
1926
+ "content": {
1927
+ "type": "STRING",
1928
+ "value": "Connection"
1929
+ },
1930
+ "named": true,
1931
+ "value": "builtin_type"
1932
+ },
1933
+ {
1934
+ "type": "ALIAS",
1935
+ "content": {
1936
+ "type": "STRING",
1937
+ "value": "History"
1938
+ },
1939
+ "named": true,
1940
+ "value": "builtin_type"
1941
+ }
1942
+ ]
1943
+ }
1944
+ },
1945
+ {
1946
+ "type": "STRING",
1947
+ "value": "["
1948
+ },
1963
1949
  {
1964
1950
  "type": "FIELD",
1965
1951
  "name": "arg",
@@ -1969,30 +1955,70 @@
1969
1955
  }
1970
1956
  },
1971
1957
  {
1972
- "type": "REPEAT",
1958
+ "type": "STRING",
1959
+ "value": "]"
1960
+ }
1961
+ ]
1962
+ },
1963
+ {
1964
+ "type": "SEQ",
1965
+ "members": [
1966
+ {
1967
+ "type": "FIELD",
1968
+ "name": "name",
1973
1969
  "content": {
1974
- "type": "SEQ",
1970
+ "type": "CHOICE",
1975
1971
  "members": [
1976
1972
  {
1977
- "type": "STRING",
1978
- "value": ","
1973
+ "type": "ALIAS",
1974
+ "content": {
1975
+ "type": "STRING",
1976
+ "value": "Result"
1977
+ },
1978
+ "named": true,
1979
+ "value": "builtin_type"
1979
1980
  },
1980
1981
  {
1981
- "type": "FIELD",
1982
- "name": "arg",
1982
+ "type": "ALIAS",
1983
1983
  "content": {
1984
- "type": "SYMBOL",
1985
- "name": "_type_ref"
1986
- }
1984
+ "type": "STRING",
1985
+ "value": "Map"
1986
+ },
1987
+ "named": true,
1988
+ "value": "builtin_type"
1987
1989
  }
1988
1990
  ]
1989
1991
  }
1992
+ },
1993
+ {
1994
+ "type": "STRING",
1995
+ "value": "["
1996
+ },
1997
+ {
1998
+ "type": "FIELD",
1999
+ "name": "arg",
2000
+ "content": {
2001
+ "type": "SYMBOL",
2002
+ "name": "_type_ref"
2003
+ }
2004
+ },
2005
+ {
2006
+ "type": "STRING",
2007
+ "value": ","
2008
+ },
2009
+ {
2010
+ "type": "FIELD",
2011
+ "name": "arg",
2012
+ "content": {
2013
+ "type": "SYMBOL",
2014
+ "name": "_type_ref"
2015
+ }
2016
+ },
2017
+ {
2018
+ "type": "STRING",
2019
+ "value": "]"
1990
2020
  }
1991
2021
  ]
1992
- },
1993
- {
1994
- "type": "STRING",
1995
- "value": "]"
1996
2022
  }
1997
2023
  ]
1998
2024
  },
@@ -5179,9 +5205,75 @@
5179
5205
  "type": "SYMBOL",
5180
5206
  "name": "_expression"
5181
5207
  }
5208
+ },
5209
+ {
5210
+ "type": "CHOICE",
5211
+ "members": [
5212
+ {
5213
+ "type": "FIELD",
5214
+ "name": "principal",
5215
+ "content": {
5216
+ "type": "SYMBOL",
5217
+ "name": "call_site_actor"
5218
+ }
5219
+ },
5220
+ {
5221
+ "type": "BLANK"
5222
+ }
5223
+ ]
5182
5224
  }
5183
5225
  ]
5184
5226
  },
5227
+ "call_site_actor": {
5228
+ "type": "PREC_RIGHT",
5229
+ "value": 0,
5230
+ "content": {
5231
+ "type": "SEQ",
5232
+ "members": [
5233
+ {
5234
+ "type": "STRING",
5235
+ "value": "by"
5236
+ },
5237
+ {
5238
+ "type": "FIELD",
5239
+ "name": "actor",
5240
+ "content": {
5241
+ "type": "SYMBOL",
5242
+ "name": "identifier"
5243
+ }
5244
+ },
5245
+ {
5246
+ "type": "CHOICE",
5247
+ "members": [
5248
+ {
5249
+ "type": "SEQ",
5250
+ "members": [
5251
+ {
5252
+ "type": "STRING",
5253
+ "value": "("
5254
+ },
5255
+ {
5256
+ "type": "FIELD",
5257
+ "name": "identity",
5258
+ "content": {
5259
+ "type": "SYMBOL",
5260
+ "name": "_expression"
5261
+ }
5262
+ },
5263
+ {
5264
+ "type": "STRING",
5265
+ "value": ")"
5266
+ }
5267
+ ]
5268
+ },
5269
+ {
5270
+ "type": "BLANK"
5271
+ }
5272
+ ]
5273
+ }
5274
+ ]
5275
+ }
5276
+ },
5185
5277
  "effect_send_stmt": {
5186
5278
  "type": "SEQ",
5187
5279
  "members": [
@@ -6171,6 +6263,10 @@
6171
6263
  "type": "SYMBOL",
6172
6264
  "name": "val_expr"
6173
6265
  },
6266
+ {
6267
+ "type": "SYMBOL",
6268
+ "name": "wire_expr"
6269
+ },
6174
6270
  {
6175
6271
  "type": "SYMBOL",
6176
6272
  "name": "trace_expr"
@@ -7213,6 +7309,35 @@
7213
7309
  }
7214
7310
  ]
7215
7311
  },
7312
+ "wire_expr": {
7313
+ "type": "PREC_RIGHT",
7314
+ "value": 0,
7315
+ "content": {
7316
+ "type": "SEQ",
7317
+ "members": [
7318
+ {
7319
+ "type": "STRING",
7320
+ "value": "Wire"
7321
+ },
7322
+ {
7323
+ "type": "STRING",
7324
+ "value": "("
7325
+ },
7326
+ {
7327
+ "type": "FIELD",
7328
+ "name": "input",
7329
+ "content": {
7330
+ "type": "SYMBOL",
7331
+ "name": "_expression"
7332
+ }
7333
+ },
7334
+ {
7335
+ "type": "STRING",
7336
+ "value": ")"
7337
+ }
7338
+ ]
7339
+ }
7340
+ },
7216
7341
  "self_expr": {
7217
7342
  "type": "STRING",
7218
7343
  "value": "self"