tree-sitter-bynk 0.239.0 → 0.245.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
@@ -347,11 +347,16 @@ module.exports = grammar({
347
347
  // Events track, slice 0 (spine #936): `event Name = { fields }` — a
348
348
  // typed fact a context may emit and other contexts' subscriber services
349
349
  // may receive. Record body only (mirrors `record_type`, not the full
350
- // `_type_body` choice — no sum/opaque/refined event shapes).
350
+ // `_type_body` choice — no sum/opaque/refined event shapes). Slice 3b
351
+ // (#978) adds an optional `@schema(N)` annotation, reusing
352
+ // `store_annotation` (the same generic `@name(args)` shape `messages_decl`
353
+ // already reuses) rather than a new rule — the closed registry (today:
354
+ // `@schema` alone) is a checker concern, not a grammar one.
351
355
  event_decl: ($) =>
352
356
  seq(
353
357
  "event",
354
358
  field("name", $.identifier),
359
+ repeat(field("annotation", $.store_annotation)),
355
360
  "=",
356
361
  field("body", $.record_type),
357
362
  ),
@@ -752,6 +757,7 @@ module.exports = grammar({
752
757
  field("event_type", $._type_ref),
753
758
  optional(field("pattern", $.event_pattern)),
754
759
  ")",
760
+ optional(field("schema_dispatch", $.schema_dispatch_clause)),
755
761
  ),
756
762
  ),
757
763
  ),
@@ -768,6 +774,22 @@ module.exports = grammar({
768
774
  "..",
769
775
  "}",
770
776
  ),
777
+ // Events track, slice 4 (spine #936): dispatch by the envelope's
778
+ // `schemaVersion`, parallel to the payload pattern above but written
779
+ // after the closing `)` (matching the design notes' own form) rather
780
+ // than nested inside it. Nested inside the `Events` choice arm, not a
781
+ // free-standing clause any protocol could carry — `via` on `http`/
782
+ // `cron`/`queue`/`websocket` is a syntax error, not a checker
783
+ // diagnostic. Literal only (v1 of this clause); a range pattern
784
+ // (`via schema(2..)`) is unbuilt grammar, left to a future slice.
785
+ schema_dispatch_clause: ($) =>
786
+ seq(
787
+ "via",
788
+ "schema",
789
+ "(",
790
+ field("version", seq(optional("-"), $.number_literal)),
791
+ ")",
792
+ ),
771
793
  event_pattern_field: ($) =>
772
794
  seq(
773
795
  field("name", $.identifier),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tree-sitter-bynk",
3
- "version": "0.239.0",
3
+ "version": "0.245.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
@@ -1221,6 +1221,17 @@
1221
1221
  "name": "identifier"
1222
1222
  }
1223
1223
  },
1224
+ {
1225
+ "type": "REPEAT",
1226
+ "content": {
1227
+ "type": "FIELD",
1228
+ "name": "annotation",
1229
+ "content": {
1230
+ "type": "SYMBOL",
1231
+ "name": "store_annotation"
1232
+ }
1233
+ }
1234
+ },
1224
1235
  {
1225
1236
  "type": "STRING",
1226
1237
  "value": "="
@@ -3250,6 +3261,22 @@
3250
3261
  {
3251
3262
  "type": "STRING",
3252
3263
  "value": ")"
3264
+ },
3265
+ {
3266
+ "type": "CHOICE",
3267
+ "members": [
3268
+ {
3269
+ "type": "FIELD",
3270
+ "name": "schema_dispatch",
3271
+ "content": {
3272
+ "type": "SYMBOL",
3273
+ "name": "schema_dispatch_clause"
3274
+ }
3275
+ },
3276
+ {
3277
+ "type": "BLANK"
3278
+ }
3279
+ ]
3253
3280
  }
3254
3281
  ]
3255
3282
  }
@@ -3294,6 +3321,52 @@
3294
3321
  }
3295
3322
  ]
3296
3323
  },
3324
+ "schema_dispatch_clause": {
3325
+ "type": "SEQ",
3326
+ "members": [
3327
+ {
3328
+ "type": "STRING",
3329
+ "value": "via"
3330
+ },
3331
+ {
3332
+ "type": "STRING",
3333
+ "value": "schema"
3334
+ },
3335
+ {
3336
+ "type": "STRING",
3337
+ "value": "("
3338
+ },
3339
+ {
3340
+ "type": "FIELD",
3341
+ "name": "version",
3342
+ "content": {
3343
+ "type": "SEQ",
3344
+ "members": [
3345
+ {
3346
+ "type": "CHOICE",
3347
+ "members": [
3348
+ {
3349
+ "type": "STRING",
3350
+ "value": "-"
3351
+ },
3352
+ {
3353
+ "type": "BLANK"
3354
+ }
3355
+ ]
3356
+ },
3357
+ {
3358
+ "type": "SYMBOL",
3359
+ "name": "number_literal"
3360
+ }
3361
+ ]
3362
+ }
3363
+ },
3364
+ {
3365
+ "type": "STRING",
3366
+ "value": ")"
3367
+ }
3368
+ ]
3369
+ },
3297
3370
  "event_pattern_field": {
3298
3371
  "type": "SEQ",
3299
3372
  "members": [
@@ -3093,6 +3093,16 @@
3093
3093
  "type": "event_decl",
3094
3094
  "named": true,
3095
3095
  "fields": {
3096
+ "annotation": {
3097
+ "multiple": true,
3098
+ "required": false,
3099
+ "types": [
3100
+ {
3101
+ "type": "store_annotation",
3102
+ "named": true
3103
+ }
3104
+ ]
3105
+ },
3096
3106
  "body": {
3097
3107
  "multiple": false,
3098
3108
  "required": true,
@@ -8052,6 +8062,26 @@
8052
8062
  }
8053
8063
  }
8054
8064
  },
8065
+ {
8066
+ "type": "schema_dispatch_clause",
8067
+ "named": true,
8068
+ "fields": {
8069
+ "version": {
8070
+ "multiple": true,
8071
+ "required": true,
8072
+ "types": [
8073
+ {
8074
+ "type": "-",
8075
+ "named": false
8076
+ },
8077
+ {
8078
+ "type": "number_literal",
8079
+ "named": true
8080
+ }
8081
+ ]
8082
+ }
8083
+ }
8084
+ },
8055
8085
  {
8056
8086
  "type": "scheme",
8057
8087
  "named": true,
@@ -8484,6 +8514,16 @@
8484
8514
  "named": true
8485
8515
  }
8486
8516
  ]
8517
+ },
8518
+ "schema_dispatch": {
8519
+ "multiple": false,
8520
+ "required": false,
8521
+ "types": [
8522
+ {
8523
+ "type": "schema_dispatch_clause",
8524
+ "named": true
8525
+ }
8526
+ ]
8487
8527
  }
8488
8528
  }
8489
8529
  },
@@ -11341,6 +11381,10 @@
11341
11381
  "type": "schedule",
11342
11382
  "named": false
11343
11383
  },
11384
+ {
11385
+ "type": "schema",
11386
+ "named": false
11387
+ },
11344
11388
  {
11345
11389
  "type": "security",
11346
11390
  "named": false
@@ -11405,6 +11449,10 @@
11405
11449
  "type": "validation_error_type",
11406
11450
  "named": true
11407
11451
  },
11452
+ {
11453
+ "type": "via",
11454
+ "named": false
11455
+ },
11408
11456
  {
11409
11457
  "type": "websocket",
11410
11458
  "named": false