tree-sitter-bynk 0.512.10 → 0.562.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 CHANGED
@@ -102,6 +102,15 @@ module.exports = grammar({
102
102
  // Both parses are equivalent once the next `on`/`store`/handler-body
103
103
  // token is seen, so GLR resolves it rather than the grammar needing to.
104
104
  [$.store_field],
105
+ // #3191: `by` is contextual. After a statement's value, `by` opens a
106
+ // call-site actor clause (`let r <- f() by User("bob")`) or is the first
107
+ // token of the next statement, an ordinary name (`by`, `by.log()`). One
108
+ // token cannot tell them apart; GLR keeps both, and `call_site_actor`'s
109
+ // dynamic precedence settles it for the clause. The compiler is the
110
+ // authority on the contrived one-line layout (it also asks for the actor to
111
+ // follow on the same line); the grammar has no newline awareness.
112
+ [$.let_else_stmt],
113
+ [$.effect_let_stmt],
105
114
  ],
106
115
 
107
116
  rules: {
@@ -279,6 +288,8 @@ module.exports = grammar({
279
288
  $.env_clause,
280
289
  $.stub_clause,
281
290
  $.fixture_decl,
291
+ $.type_decl,
292
+ $.const_decl,
282
293
  $.fn_decl,
283
294
  $.case,
284
295
  $.property_decl,
@@ -415,6 +426,8 @@ module.exports = grammar({
415
426
  "opaque",
416
427
  field("base", $._base_type),
417
428
  optional(seq("where", field("refinement", $.refinement))),
429
+ // #2686: `@example(…)` after the refinement.
430
+ repeat(field("annotation", $.store_annotation)),
418
431
  ),
419
432
 
420
433
  refined_type: ($) =>
@@ -423,6 +436,8 @@ module.exports = grammar({
423
436
  seq(
424
437
  field("base", $._base_type),
425
438
  optional(seq("where", field("refinement", $.refinement))),
439
+ // #2686: `@example(…)` after the refinement.
440
+ repeat(field("annotation", $.store_annotation)),
426
441
  ),
427
442
  ),
428
443
 
@@ -436,10 +451,14 @@ module.exports = grammar({
436
451
 
437
452
  record_field: ($) =>
438
453
  seq(
454
+ // #3343: `@name("…")` before the field, the key it has on a request.
455
+ repeat(field("annotation", $.store_annotation)),
439
456
  field("name", $.identifier),
440
457
  ":",
441
458
  field("type", $._type_ref),
442
459
  optional(seq("where", field("refinement", $.refinement))),
460
+ // #2686: `@example(…)` after the refinement.
461
+ repeat(field("annotation", $.store_annotation)),
443
462
  // v0.11: an optional initial-value expression. Meaningful on agent
444
463
  // `store` fields; the checker restricts where it applies.
445
464
  optional(seq("=", field("init", $._expression))),
@@ -950,6 +969,9 @@ module.exports = grammar({
950
969
  "http",
951
970
  "cron",
952
971
  seq("queue", "(", field("name", $.string_literal), ")"),
972
+ // #3328: `from email("support@shop.example")` — inbound email.
973
+ // `email` is contextual, like `websocket`.
974
+ seq("email", "(", field("address", $.string_literal), ")"),
953
975
  seq(
954
976
  "websocket",
955
977
  "(",
@@ -1132,7 +1154,9 @@ module.exports = grammar({
1132
1154
  ),
1133
1155
  annotation_arg: ($) =>
1134
1156
  seq(
1135
- optional(seq(field("label", $.identifier), ":")),
1157
+ // #3191: `by:` is a label here (`@indexed(by: f)`), and `by` is also a
1158
+ // contextual identifier a value may start with.
1159
+ optional(seq(field("label", choice($.identifier, $._contextual_identifier)), ":")),
1136
1160
  field("value", $._expression),
1137
1161
  ),
1138
1162
 
@@ -1584,7 +1608,9 @@ module.exports = grammar({
1584
1608
  // `prec.right` so an immediately-following `(` is taken as the identity
1585
1609
  // argument rather than starting a fresh token sequence.
1586
1610
  call_site_actor: ($) =>
1587
- prec.right(
1611
+ prec.dynamic(
1612
+ 1,
1613
+ prec.right(
1588
1614
  seq(
1589
1615
  "by",
1590
1616
  field("actor", $.identifier),
@@ -1598,6 +1624,7 @@ module.exports = grammar({
1598
1624
  ),
1599
1625
  ),
1600
1626
  ),
1627
+ ),
1601
1628
  ),
1602
1629
  // v0.79: `~> expr` — an asynchronous fire-and-forget send (no binder).
1603
1630
  effect_send_stmt: ($) => seq("~>", field("value", $._expression)),
@@ -1995,8 +2022,9 @@ module.exports = grammar({
1995
2022
  $._contextual_identifier,
1996
2023
  ),
1997
2024
 
1998
- // `trace`, `advance` and `par` are contextual in the compiler — ordinary
1999
- // identifiers outside `trace(Cap.op)` / `advance Clock by …`. Here, as
2025
+ // `trace`, `advance`, `par` and `by` are contextual in the compiler — ordinary
2026
+ // identifiers outside `trace(Cap.op)` / `advance Clock by …` / an actor
2027
+ // clause (`by` is a clause word only before the actor it names, #3191). Here, as
2000
2028
  // `word`-shaped literals, they are extracted as keyword tokens, and where an
2001
2029
  // identifier and the keyword are both valid (an expression or statement
2002
2030
  // head) the keyword always wins the lex. Re-admit the keyword token as an
@@ -2004,7 +2032,7 @@ module.exports = grammar({
2004
2032
  // followed by an identifier can only open an `advance_stmt`, and `trace (`
2005
2033
  // is a declared conflict that `trace_expr`'s dynamic precedence settles.
2006
2034
  _contextual_identifier: ($) =>
2007
- alias(choice("trace", "advance", "par"), $.identifier),
2035
+ alias(choice("trace", "advance", "par", "by"), $.identifier),
2008
2036
 
2009
2037
  // v0.20a: a lambda — `(params) => expr | block`. Conflicts with
2010
2038
  // paren_expr/unit_literal until the `=>` disambiguates (GLR conflict
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tree-sitter-bynk",
3
- "version": "0.512.10",
3
+ "version": "0.562.0",
4
4
  "description": "Tree-sitter grammar for the Bynk language.",
5
5
  "main": "bindings/node",
6
6
  "types": "bindings/node",
@@ -21,6 +21,7 @@
21
21
  "cron"
22
22
  "queue"
23
23
  "websocket"
24
+ "email"
24
25
  "schedule"
25
26
  "message"
26
27
  "Events"
package/src/grammar.json CHANGED
@@ -586,6 +586,14 @@
586
586
  "type": "SYMBOL",
587
587
  "name": "fixture_decl"
588
588
  },
589
+ {
590
+ "type": "SYMBOL",
591
+ "name": "type_decl"
592
+ },
593
+ {
594
+ "type": "SYMBOL",
595
+ "name": "const_decl"
596
+ },
589
597
  {
590
598
  "type": "SYMBOL",
591
599
  "name": "fn_decl"
@@ -1398,6 +1406,17 @@
1398
1406
  "type": "BLANK"
1399
1407
  }
1400
1408
  ]
1409
+ },
1410
+ {
1411
+ "type": "REPEAT",
1412
+ "content": {
1413
+ "type": "FIELD",
1414
+ "name": "annotation",
1415
+ "content": {
1416
+ "type": "SYMBOL",
1417
+ "name": "store_annotation"
1418
+ }
1419
+ }
1401
1420
  }
1402
1421
  ]
1403
1422
  },
@@ -1439,6 +1458,17 @@
1439
1458
  "type": "BLANK"
1440
1459
  }
1441
1460
  ]
1461
+ },
1462
+ {
1463
+ "type": "REPEAT",
1464
+ "content": {
1465
+ "type": "FIELD",
1466
+ "name": "annotation",
1467
+ "content": {
1468
+ "type": "SYMBOL",
1469
+ "name": "store_annotation"
1470
+ }
1471
+ }
1442
1472
  }
1443
1473
  ]
1444
1474
  }
@@ -1504,6 +1534,17 @@
1504
1534
  "record_field": {
1505
1535
  "type": "SEQ",
1506
1536
  "members": [
1537
+ {
1538
+ "type": "REPEAT",
1539
+ "content": {
1540
+ "type": "FIELD",
1541
+ "name": "annotation",
1542
+ "content": {
1543
+ "type": "SYMBOL",
1544
+ "name": "store_annotation"
1545
+ }
1546
+ }
1547
+ },
1507
1548
  {
1508
1549
  "type": "FIELD",
1509
1550
  "name": "name",
@@ -1549,6 +1590,17 @@
1549
1590
  }
1550
1591
  ]
1551
1592
  },
1593
+ {
1594
+ "type": "REPEAT",
1595
+ "content": {
1596
+ "type": "FIELD",
1597
+ "name": "annotation",
1598
+ "content": {
1599
+ "type": "SYMBOL",
1600
+ "name": "store_annotation"
1601
+ }
1602
+ }
1603
+ },
1552
1604
  {
1553
1605
  "type": "CHOICE",
1554
1606
  "members": [
@@ -3997,6 +4049,31 @@
3997
4049
  }
3998
4050
  ]
3999
4051
  },
4052
+ {
4053
+ "type": "SEQ",
4054
+ "members": [
4055
+ {
4056
+ "type": "STRING",
4057
+ "value": "email"
4058
+ },
4059
+ {
4060
+ "type": "STRING",
4061
+ "value": "("
4062
+ },
4063
+ {
4064
+ "type": "FIELD",
4065
+ "name": "address",
4066
+ "content": {
4067
+ "type": "SYMBOL",
4068
+ "name": "string_literal"
4069
+ }
4070
+ },
4071
+ {
4072
+ "type": "STRING",
4073
+ "value": ")"
4074
+ }
4075
+ ]
4076
+ },
4000
4077
  {
4001
4078
  "type": "SEQ",
4002
4079
  "members": [
@@ -4859,8 +4936,17 @@
4859
4936
  "type": "FIELD",
4860
4937
  "name": "label",
4861
4938
  "content": {
4862
- "type": "SYMBOL",
4863
- "name": "identifier"
4939
+ "type": "CHOICE",
4940
+ "members": [
4941
+ {
4942
+ "type": "SYMBOL",
4943
+ "name": "identifier"
4944
+ },
4945
+ {
4946
+ "type": "SYMBOL",
4947
+ "name": "_contextual_identifier"
4948
+ }
4949
+ ]
4864
4950
  }
4865
4951
  },
4866
4952
  {
@@ -7525,78 +7611,82 @@
7525
7611
  ]
7526
7612
  },
7527
7613
  "call_site_actor": {
7528
- "type": "PREC_RIGHT",
7529
- "value": 0,
7614
+ "type": "PREC_DYNAMIC",
7615
+ "value": 1,
7530
7616
  "content": {
7531
- "type": "SEQ",
7532
- "members": [
7533
- {
7534
- "type": "STRING",
7535
- "value": "by"
7536
- },
7537
- {
7538
- "type": "FIELD",
7539
- "name": "actor",
7540
- "content": {
7541
- "type": "SYMBOL",
7542
- "name": "identifier"
7543
- }
7544
- },
7545
- {
7546
- "type": "CHOICE",
7547
- "members": [
7548
- {
7549
- "type": "SEQ",
7550
- "members": [
7551
- {
7552
- "type": "STRING",
7553
- "value": "("
7554
- },
7555
- {
7556
- "type": "FIELD",
7557
- "name": "identity",
7558
- "content": {
7559
- "type": "SYMBOL",
7560
- "name": "_expression"
7561
- }
7562
- },
7563
- {
7564
- "type": "CHOICE",
7565
- "members": [
7566
- {
7567
- "type": "SEQ",
7568
- "members": [
7569
- {
7570
- "type": "STRING",
7571
- "value": ","
7572
- },
7573
- {
7574
- "type": "FIELD",
7575
- "name": "claims",
7576
- "content": {
7577
- "type": "SYMBOL",
7578
- "name": "_expression"
7579
- }
7580
- }
7581
- ]
7582
- },
7583
- {
7584
- "type": "BLANK"
7585
- }
7586
- ]
7587
- },
7588
- {
7589
- "type": "STRING",
7590
- "value": ")"
7591
- }
7592
- ]
7593
- },
7594
- {
7595
- "type": "BLANK"
7617
+ "type": "PREC_RIGHT",
7618
+ "value": 0,
7619
+ "content": {
7620
+ "type": "SEQ",
7621
+ "members": [
7622
+ {
7623
+ "type": "STRING",
7624
+ "value": "by"
7625
+ },
7626
+ {
7627
+ "type": "FIELD",
7628
+ "name": "actor",
7629
+ "content": {
7630
+ "type": "SYMBOL",
7631
+ "name": "identifier"
7596
7632
  }
7597
- ]
7598
- }
7599
- ]
7633
+ },
7634
+ {
7635
+ "type": "CHOICE",
7636
+ "members": [
7637
+ {
7638
+ "type": "SEQ",
7639
+ "members": [
7640
+ {
7641
+ "type": "STRING",
7642
+ "value": "("
7643
+ },
7644
+ {
7645
+ "type": "FIELD",
7646
+ "name": "identity",
7647
+ "content": {
7648
+ "type": "SYMBOL",
7649
+ "name": "_expression"
7650
+ }
7651
+ },
7652
+ {
7653
+ "type": "CHOICE",
7654
+ "members": [
7655
+ {
7656
+ "type": "SEQ",
7657
+ "members": [
7658
+ {
7659
+ "type": "STRING",
7660
+ "value": ","
7661
+ },
7662
+ {
7663
+ "type": "FIELD",
7664
+ "name": "claims",
7665
+ "content": {
7666
+ "type": "SYMBOL",
7667
+ "name": "_expression"
7668
+ }
7669
+ }
7670
+ ]
7671
+ },
7672
+ {
7673
+ "type": "BLANK"
7674
+ }
7675
+ ]
7676
+ },
7677
+ {
7678
+ "type": "STRING",
7679
+ "value": ")"
7680
+ }
7681
+ ]
7682
+ },
7683
+ {
7684
+ "type": "BLANK"
7685
+ }
7686
+ ]
7687
+ }
7688
+ ]
7689
+ }
7600
7690
  }
7601
7691
  },
7602
7692
  "effect_send_stmt": {
@@ -9272,6 +9362,10 @@
9272
9362
  {
9273
9363
  "type": "STRING",
9274
9364
  "value": "par"
9365
+ },
9366
+ {
9367
+ "type": "STRING",
9368
+ "value": "by"
9275
9369
  }
9276
9370
  ]
9277
9371
  },
@@ -10897,6 +10991,12 @@
10897
10991
  ],
10898
10992
  [
10899
10993
  "store_field"
10994
+ ],
10995
+ [
10996
+ "let_else_stmt"
10997
+ ],
10998
+ [
10999
+ "effect_let_stmt"
10900
11000
  ]
10901
11001
  ],
10902
11002
  "precedences": [],
@@ -8618,6 +8618,16 @@
8618
8618
  "type": "opaque_type",
8619
8619
  "named": true,
8620
8620
  "fields": {
8621
+ "annotation": {
8622
+ "multiple": true,
8623
+ "required": false,
8624
+ "types": [
8625
+ {
8626
+ "type": "store_annotation",
8627
+ "named": true
8628
+ }
8629
+ ]
8630
+ },
8621
8631
  "base": {
8622
8632
  "multiple": false,
8623
8633
  "required": true,
@@ -9448,6 +9458,16 @@
9448
9458
  "type": "record_field",
9449
9459
  "named": true,
9450
9460
  "fields": {
9461
+ "annotation": {
9462
+ "multiple": true,
9463
+ "required": false,
9464
+ "types": [
9465
+ {
9466
+ "type": "store_annotation",
9467
+ "named": true
9468
+ }
9469
+ ]
9470
+ },
9451
9471
  "init": {
9452
9472
  "multiple": false,
9453
9473
  "required": false,
@@ -9927,6 +9947,16 @@
9927
9947
  "type": "refined_type",
9928
9948
  "named": true,
9929
9949
  "fields": {
9950
+ "annotation": {
9951
+ "multiple": true,
9952
+ "required": false,
9953
+ "types": [
9954
+ {
9955
+ "type": "store_annotation",
9956
+ "named": true
9957
+ }
9958
+ ]
9959
+ },
9930
9960
  "base": {
9931
9961
  "multiple": false,
9932
9962
  "required": true,
@@ -10577,6 +10607,16 @@
10577
10607
  "type": "service_protocol",
10578
10608
  "named": true,
10579
10609
  "fields": {
10610
+ "address": {
10611
+ "multiple": false,
10612
+ "required": false,
10613
+ "types": [
10614
+ {
10615
+ "type": "string_literal",
10616
+ "named": true
10617
+ }
10618
+ ]
10619
+ },
10580
10620
  "event_type": {
10581
10621
  "multiple": false,
10582
10622
  "required": false,
@@ -12328,6 +12368,10 @@
12328
12368
  "type": "case",
12329
12369
  "named": true
12330
12370
  },
12371
+ {
12372
+ "type": "const_decl",
12373
+ "named": true
12374
+ },
12331
12375
  {
12332
12376
  "type": "consumes_decl",
12333
12377
  "named": true
@@ -12352,6 +12396,10 @@
12352
12396
  "type": "stub_clause",
12353
12397
  "named": true
12354
12398
  },
12399
+ {
12400
+ "type": "type_decl",
12401
+ "named": true
12402
+ },
12355
12403
  {
12356
12404
  "type": "uses_decl",
12357
12405
  "named": true
@@ -13954,6 +14002,10 @@
13954
14002
  "type": "else",
13955
14003
  "named": false
13956
14004
  },
14005
+ {
14006
+ "type": "email",
14007
+ "named": false
14008
+ },
13957
14009
  {
13958
14010
  "type": "embed",
13959
14011
  "named": false