tree-sitter-bynk 0.107.0 → 0.109.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
@@ -436,6 +436,10 @@ module.exports = grammar({
436
436
  // v0.20b: the built-in collection types.
437
437
  alias("List", $.builtin_type),
438
438
  alias("Map", $.builtin_type),
439
+ // v0.100/v0.92/v0.102: stream, lazy storage query, held connection.
440
+ alias("Stream", $.builtin_type),
441
+ alias("Query", $.builtin_type),
442
+ alias("Connection", $.builtin_type),
439
443
  ),
440
444
  ),
441
445
  "[",
@@ -534,6 +538,8 @@ module.exports = grammar({
534
538
  "}",
535
539
  ),
536
540
  // v0.44: `from <protocol>` on the service header.
541
+ // v0.103: `from WebSocket(in: I, out: O)` binds the inbound/outbound frame
542
+ // types. `WebSocket`, `in`, and `out` are contextual (resolved by `word`).
537
543
  service_protocol: ($) =>
538
544
  seq(
539
545
  "from",
@@ -541,6 +547,19 @@ module.exports = grammar({
541
547
  "http",
542
548
  "cron",
543
549
  seq("queue", "(", field("name", $.string_literal), ")"),
550
+ seq(
551
+ "WebSocket",
552
+ "(",
553
+ "in",
554
+ ":",
555
+ field("in_frame", $._type_ref),
556
+ ",",
557
+ "out",
558
+ ":",
559
+ field("out_frame", $._type_ref),
560
+ optional(","),
561
+ ")",
562
+ ),
544
563
  ),
545
564
  ),
546
565
 
@@ -606,7 +625,16 @@ module.exports = grammar({
606
625
  // v0.5 `on call`; v0.44 `on GET("path")` / `on schedule("expr")` /
607
626
  // `on message(...)` — the protocol lives on the service header.
608
627
  handler: ($) =>
609
- choice($.call_handler, $.http_handler, $.cron_handler, $.queue_handler),
628
+ choice(
629
+ $.call_handler,
630
+ $.http_handler,
631
+ $.cron_handler,
632
+ $.queue_handler,
633
+ // v0.103/v0.106: WebSocket lifecycle handlers. `on message` reuses the
634
+ // queue-handler shape (the protocol on the service header disambiguates).
635
+ $.ws_open_handler,
636
+ $.ws_close_handler,
637
+ ),
610
638
  call_handler: ($) =>
611
639
  seq(
612
640
  "on",
@@ -676,6 +704,37 @@ module.exports = grammar({
676
704
  optional(field("given", $.given_clause)),
677
705
  field("body", $.block),
678
706
  ),
707
+ // v0.103/v0.106: `on open` / `on close` lifecycle handlers of a
708
+ // `from WebSocket` service. `open`/`close` are contextual (resolved by
709
+ // `word`). `on message` (the inbound-frame handler) reuses queue_handler.
710
+ ws_open_handler: ($) =>
711
+ seq(
712
+ "on",
713
+ "open",
714
+ optional(field("by", $.by_clause)),
715
+ "(",
716
+ optional(sep1($.param, ",")),
717
+ optional(","),
718
+ ")",
719
+ "->",
720
+ field("return_type", $._type_ref),
721
+ optional(field("given", $.given_clause)),
722
+ field("body", $.block),
723
+ ),
724
+ ws_close_handler: ($) =>
725
+ seq(
726
+ "on",
727
+ "close",
728
+ optional(field("by", $.by_clause)),
729
+ "(",
730
+ optional(sep1($.param, ",")),
731
+ optional(","),
732
+ ")",
733
+ "->",
734
+ field("return_type", $._type_ref),
735
+ optional(field("given", $.given_clause)),
736
+ field("body", $.block),
737
+ ),
679
738
  given_clause: ($) =>
680
739
  // v0.15: a capability may be a bare local name or a dotted cross-context
681
740
  // reference (`B.Cap` / `platform.time.Clock`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tree-sitter-bynk",
3
- "version": "0.107.0",
3
+ "version": "0.109.0",
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
@@ -1795,6 +1795,33 @@
1795
1795
  },
1796
1796
  "named": true,
1797
1797
  "value": "builtin_type"
1798
+ },
1799
+ {
1800
+ "type": "ALIAS",
1801
+ "content": {
1802
+ "type": "STRING",
1803
+ "value": "Stream"
1804
+ },
1805
+ "named": true,
1806
+ "value": "builtin_type"
1807
+ },
1808
+ {
1809
+ "type": "ALIAS",
1810
+ "content": {
1811
+ "type": "STRING",
1812
+ "value": "Query"
1813
+ },
1814
+ "named": true,
1815
+ "value": "builtin_type"
1816
+ },
1817
+ {
1818
+ "type": "ALIAS",
1819
+ "content": {
1820
+ "type": "STRING",
1821
+ "value": "Connection"
1822
+ },
1823
+ "named": true,
1824
+ "value": "builtin_type"
1798
1825
  }
1799
1826
  ]
1800
1827
  }
@@ -2429,6 +2456,71 @@
2429
2456
  "value": ")"
2430
2457
  }
2431
2458
  ]
2459
+ },
2460
+ {
2461
+ "type": "SEQ",
2462
+ "members": [
2463
+ {
2464
+ "type": "STRING",
2465
+ "value": "WebSocket"
2466
+ },
2467
+ {
2468
+ "type": "STRING",
2469
+ "value": "("
2470
+ },
2471
+ {
2472
+ "type": "STRING",
2473
+ "value": "in"
2474
+ },
2475
+ {
2476
+ "type": "STRING",
2477
+ "value": ":"
2478
+ },
2479
+ {
2480
+ "type": "FIELD",
2481
+ "name": "in_frame",
2482
+ "content": {
2483
+ "type": "SYMBOL",
2484
+ "name": "_type_ref"
2485
+ }
2486
+ },
2487
+ {
2488
+ "type": "STRING",
2489
+ "value": ","
2490
+ },
2491
+ {
2492
+ "type": "STRING",
2493
+ "value": "out"
2494
+ },
2495
+ {
2496
+ "type": "STRING",
2497
+ "value": ":"
2498
+ },
2499
+ {
2500
+ "type": "FIELD",
2501
+ "name": "out_frame",
2502
+ "content": {
2503
+ "type": "SYMBOL",
2504
+ "name": "_type_ref"
2505
+ }
2506
+ },
2507
+ {
2508
+ "type": "CHOICE",
2509
+ "members": [
2510
+ {
2511
+ "type": "STRING",
2512
+ "value": ","
2513
+ },
2514
+ {
2515
+ "type": "BLANK"
2516
+ }
2517
+ ]
2518
+ },
2519
+ {
2520
+ "type": "STRING",
2521
+ "value": ")"
2522
+ }
2523
+ ]
2432
2524
  }
2433
2525
  ]
2434
2526
  }
@@ -2809,6 +2901,14 @@
2809
2901
  {
2810
2902
  "type": "SYMBOL",
2811
2903
  "name": "queue_handler"
2904
+ },
2905
+ {
2906
+ "type": "SYMBOL",
2907
+ "name": "ws_open_handler"
2908
+ },
2909
+ {
2910
+ "type": "SYMBOL",
2911
+ "name": "ws_close_handler"
2812
2912
  }
2813
2913
  ]
2814
2914
  },
@@ -3361,6 +3461,242 @@
3361
3461
  }
3362
3462
  ]
3363
3463
  },
3464
+ "ws_open_handler": {
3465
+ "type": "SEQ",
3466
+ "members": [
3467
+ {
3468
+ "type": "STRING",
3469
+ "value": "on"
3470
+ },
3471
+ {
3472
+ "type": "STRING",
3473
+ "value": "open"
3474
+ },
3475
+ {
3476
+ "type": "CHOICE",
3477
+ "members": [
3478
+ {
3479
+ "type": "FIELD",
3480
+ "name": "by",
3481
+ "content": {
3482
+ "type": "SYMBOL",
3483
+ "name": "by_clause"
3484
+ }
3485
+ },
3486
+ {
3487
+ "type": "BLANK"
3488
+ }
3489
+ ]
3490
+ },
3491
+ {
3492
+ "type": "STRING",
3493
+ "value": "("
3494
+ },
3495
+ {
3496
+ "type": "CHOICE",
3497
+ "members": [
3498
+ {
3499
+ "type": "SEQ",
3500
+ "members": [
3501
+ {
3502
+ "type": "SYMBOL",
3503
+ "name": "param"
3504
+ },
3505
+ {
3506
+ "type": "REPEAT",
3507
+ "content": {
3508
+ "type": "SEQ",
3509
+ "members": [
3510
+ {
3511
+ "type": "STRING",
3512
+ "value": ","
3513
+ },
3514
+ {
3515
+ "type": "SYMBOL",
3516
+ "name": "param"
3517
+ }
3518
+ ]
3519
+ }
3520
+ }
3521
+ ]
3522
+ },
3523
+ {
3524
+ "type": "BLANK"
3525
+ }
3526
+ ]
3527
+ },
3528
+ {
3529
+ "type": "CHOICE",
3530
+ "members": [
3531
+ {
3532
+ "type": "STRING",
3533
+ "value": ","
3534
+ },
3535
+ {
3536
+ "type": "BLANK"
3537
+ }
3538
+ ]
3539
+ },
3540
+ {
3541
+ "type": "STRING",
3542
+ "value": ")"
3543
+ },
3544
+ {
3545
+ "type": "STRING",
3546
+ "value": "->"
3547
+ },
3548
+ {
3549
+ "type": "FIELD",
3550
+ "name": "return_type",
3551
+ "content": {
3552
+ "type": "SYMBOL",
3553
+ "name": "_type_ref"
3554
+ }
3555
+ },
3556
+ {
3557
+ "type": "CHOICE",
3558
+ "members": [
3559
+ {
3560
+ "type": "FIELD",
3561
+ "name": "given",
3562
+ "content": {
3563
+ "type": "SYMBOL",
3564
+ "name": "given_clause"
3565
+ }
3566
+ },
3567
+ {
3568
+ "type": "BLANK"
3569
+ }
3570
+ ]
3571
+ },
3572
+ {
3573
+ "type": "FIELD",
3574
+ "name": "body",
3575
+ "content": {
3576
+ "type": "SYMBOL",
3577
+ "name": "block"
3578
+ }
3579
+ }
3580
+ ]
3581
+ },
3582
+ "ws_close_handler": {
3583
+ "type": "SEQ",
3584
+ "members": [
3585
+ {
3586
+ "type": "STRING",
3587
+ "value": "on"
3588
+ },
3589
+ {
3590
+ "type": "STRING",
3591
+ "value": "close"
3592
+ },
3593
+ {
3594
+ "type": "CHOICE",
3595
+ "members": [
3596
+ {
3597
+ "type": "FIELD",
3598
+ "name": "by",
3599
+ "content": {
3600
+ "type": "SYMBOL",
3601
+ "name": "by_clause"
3602
+ }
3603
+ },
3604
+ {
3605
+ "type": "BLANK"
3606
+ }
3607
+ ]
3608
+ },
3609
+ {
3610
+ "type": "STRING",
3611
+ "value": "("
3612
+ },
3613
+ {
3614
+ "type": "CHOICE",
3615
+ "members": [
3616
+ {
3617
+ "type": "SEQ",
3618
+ "members": [
3619
+ {
3620
+ "type": "SYMBOL",
3621
+ "name": "param"
3622
+ },
3623
+ {
3624
+ "type": "REPEAT",
3625
+ "content": {
3626
+ "type": "SEQ",
3627
+ "members": [
3628
+ {
3629
+ "type": "STRING",
3630
+ "value": ","
3631
+ },
3632
+ {
3633
+ "type": "SYMBOL",
3634
+ "name": "param"
3635
+ }
3636
+ ]
3637
+ }
3638
+ }
3639
+ ]
3640
+ },
3641
+ {
3642
+ "type": "BLANK"
3643
+ }
3644
+ ]
3645
+ },
3646
+ {
3647
+ "type": "CHOICE",
3648
+ "members": [
3649
+ {
3650
+ "type": "STRING",
3651
+ "value": ","
3652
+ },
3653
+ {
3654
+ "type": "BLANK"
3655
+ }
3656
+ ]
3657
+ },
3658
+ {
3659
+ "type": "STRING",
3660
+ "value": ")"
3661
+ },
3662
+ {
3663
+ "type": "STRING",
3664
+ "value": "->"
3665
+ },
3666
+ {
3667
+ "type": "FIELD",
3668
+ "name": "return_type",
3669
+ "content": {
3670
+ "type": "SYMBOL",
3671
+ "name": "_type_ref"
3672
+ }
3673
+ },
3674
+ {
3675
+ "type": "CHOICE",
3676
+ "members": [
3677
+ {
3678
+ "type": "FIELD",
3679
+ "name": "given",
3680
+ "content": {
3681
+ "type": "SYMBOL",
3682
+ "name": "given_clause"
3683
+ }
3684
+ },
3685
+ {
3686
+ "type": "BLANK"
3687
+ }
3688
+ ]
3689
+ },
3690
+ {
3691
+ "type": "FIELD",
3692
+ "name": "body",
3693
+ "content": {
3694
+ "type": "SYMBOL",
3695
+ "name": "block"
3696
+ }
3697
+ }
3698
+ ]
3699
+ },
3364
3700
  "given_clause": {
3365
3701
  "type": "SEQ",
3366
3702
  "members": [