tree-sitter-bynk 0.185.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 +54 -23
- package/package.json +1 -1
- package/src/grammar.json +176 -117
- package/src/node-types.json +340 -0
- package/src/parser.c +42714 -40683
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: () =>
|
|
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
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
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 --
|
|
@@ -1260,6 +1284,7 @@ module.exports = grammar({
|
|
|
1260
1284
|
$.none_expr,
|
|
1261
1285
|
$.effect_pure_expr,
|
|
1262
1286
|
$.val_expr,
|
|
1287
|
+
$.wire_expr,
|
|
1263
1288
|
$.trace_expr,
|
|
1264
1289
|
$.list_literal,
|
|
1265
1290
|
$.block,
|
|
@@ -1407,6 +1432,12 @@ module.exports = grammar({
|
|
|
1407
1432
|
seq("{", optional(sep1($.field_init, ",")), optional(","), "}"),
|
|
1408
1433
|
),
|
|
1409
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
|
+
|
|
1410
1441
|
self_expr: () => "self",
|
|
1411
1442
|
|
|
1412
1443
|
// -- Tokens --
|
package/package.json
CHANGED
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": "
|
|
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": "
|
|
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": "
|
|
1970
|
+
"type": "CHOICE",
|
|
1975
1971
|
"members": [
|
|
1976
1972
|
{
|
|
1977
|
-
"type": "
|
|
1978
|
-
"
|
|
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": "
|
|
1982
|
-
"name": "arg",
|
|
1982
|
+
"type": "ALIAS",
|
|
1983
1983
|
"content": {
|
|
1984
|
-
"type": "
|
|
1985
|
-
"
|
|
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
|
},
|
|
@@ -6237,6 +6263,10 @@
|
|
|
6237
6263
|
"type": "SYMBOL",
|
|
6238
6264
|
"name": "val_expr"
|
|
6239
6265
|
},
|
|
6266
|
+
{
|
|
6267
|
+
"type": "SYMBOL",
|
|
6268
|
+
"name": "wire_expr"
|
|
6269
|
+
},
|
|
6240
6270
|
{
|
|
6241
6271
|
"type": "SYMBOL",
|
|
6242
6272
|
"name": "trace_expr"
|
|
@@ -7279,6 +7309,35 @@
|
|
|
7279
7309
|
}
|
|
7280
7310
|
]
|
|
7281
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
|
+
},
|
|
7282
7341
|
"self_expr": {
|
|
7283
7342
|
"type": "STRING",
|
|
7284
7343
|
"value": "self"
|