tree-sitter-bynk 0.313.0 → 0.330.4

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
@@ -41,7 +41,7 @@ module.exports = grammar({
41
41
 
42
42
  externals: ($) => [$.doc_block],
43
43
 
44
- extras: ($) => [/\s+/, $.line_comment, $.doc_block],
44
+ extras: ($) => [/\s+/, $.doc_line, $.line_comment, $.doc_block],
45
45
 
46
46
  // The DSL allows reserved words to be referenced inside specific rules via
47
47
  // tokens; we declare keywords so they take precedence over `identifier`.
@@ -201,6 +201,7 @@ module.exports = grammar({
201
201
  $.agent_decl,
202
202
  $.actor_decl,
203
203
  $.event_decl,
204
+ $.asset_decl,
204
205
  ),
205
206
 
206
207
  _context_body_item: ($) =>
@@ -217,6 +218,7 @@ module.exports = grammar({
217
218
  $.actor_decl,
218
219
  $.messages_decl,
219
220
  $.event_decl,
221
+ $.asset_decl,
220
222
  ),
221
223
 
222
224
  // v0.17: adapter items — a binding clause, capabilities, boundary types,
@@ -239,6 +241,7 @@ module.exports = grammar({
239
241
  $.actor_decl,
240
242
  $.messages_decl,
241
243
  $.event_decl,
244
+ $.asset_decl,
242
245
  ),
243
246
 
244
247
  _test_body_item: ($) =>
@@ -368,6 +371,21 @@ module.exports = grammar({
368
371
  field("body", $.record_type),
369
372
  ),
370
373
 
374
+ // #1883 (static assets), slice 1a: `asset name = "path"` — one static
375
+ // file the platform serves. Admitted in every body (commons, context,
376
+ // adapter) like `event`; placement is a checker concern
377
+ // (`bynk.asset.outside_context_or_commons` rejects it in an adapter).
378
+ asset_decl: ($) =>
379
+ seq(
380
+ "asset",
381
+ field("name", $.identifier),
382
+ "=",
383
+ field("path", $.string_literal),
384
+ // #1883, slice 2: an optional fixed URL path. `at` is contextual,
385
+ // matched only here (the `word` rule keeps it an identifier elsewhere).
386
+ optional(seq("at", field("at", $.string_literal))),
387
+ ),
388
+
371
389
  // v0.154 (ADR 0178): a sum body may carry a trailing `embeds E as V, …`
372
390
  // clause declaring error embeddings the `?` operator auto-converts.
373
391
  // `embeds`/`as` are contextual — matched only in this position.
@@ -1295,7 +1313,14 @@ module.exports = grammar({
1295
1313
  // call throws. `faults` is contextual (an ordinary identifier elsewhere),
1296
1314
  // mirroring the compiler's trailing-word parse; an expression is never
1297
1315
  // followed by a bare identifier, so the word alone decides.
1298
- faults_expr: ($) => seq(field("call", $._expression), "faults"),
1316
+ // #1812: an optional call-site actor sits between the call and `faults`,
1317
+ // in the same position as on an effect-let (`by User("bob")`).
1318
+ faults_expr: ($) =>
1319
+ seq(
1320
+ field("call", $._expression),
1321
+ optional(field("principal", $.call_site_actor)),
1322
+ "faults",
1323
+ ),
1299
1324
 
1300
1325
  // v0.117: an observation — a `Cap.op` seam reference followed by one of the
1301
1326
  // sugar matchers. `called` / `never` / `once` / `times` / `with` / `before`
@@ -1686,6 +1711,13 @@ module.exports = grammar({
1686
1711
  // dash sequence that's already been gobbled by the external scanner).
1687
1712
  line_comment: () => token(seq("--", /[^\n]*/)),
1688
1713
 
1714
+ // #1888: a `--|` one-line doc. Both it and `line_comment` match a
1715
+ // `--|` line to its end, so the higher lexical precedence makes it a
1716
+ // doc. The compiler takes `--|` as a doc only when it is the first thing
1717
+ // on its line; an extras token cannot see that, so a `--|` after code on
1718
+ // the same line highlights as a doc here though it compiles as a comment.
1719
+ doc_line: () => token(prec(1, seq("--|", /[^\n]*/))),
1720
+
1689
1721
  // `doc_block` is provided by the external scanner — see src/scanner.c.
1690
1722
  // The grammar references it via the `externals` array above.
1691
1723
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tree-sitter-bynk",
3
- "version": "0.313.0",
3
+ "version": "0.330.4",
4
4
  "description": "Tree-sitter grammar for the Bynk language.",
5
5
  "main": "bindings/node",
6
6
  "types": "bindings/node",
@@ -57,6 +57,7 @@
57
57
  "ensures"
58
58
  "messages"
59
59
  "event"
60
+ "asset"
60
61
  ] @keyword.declaration
61
62
 
62
63
  [
@@ -240,6 +241,7 @@
240
241
 
241
242
  (line_comment) @comment
242
243
  (doc_block) @comment.documentation
244
+ (doc_line) @comment.documentation
243
245
 
244
246
  ; -- Errors (tree-sitter recovery) --
245
247
 
package/src/grammar.json CHANGED
@@ -410,6 +410,10 @@
410
410
  {
411
411
  "type": "SYMBOL",
412
412
  "name": "event_decl"
413
+ },
414
+ {
415
+ "type": "SYMBOL",
416
+ "name": "asset_decl"
413
417
  }
414
418
  ]
415
419
  },
@@ -463,6 +467,10 @@
463
467
  {
464
468
  "type": "SYMBOL",
465
469
  "name": "event_decl"
470
+ },
471
+ {
472
+ "type": "SYMBOL",
473
+ "name": "asset_decl"
466
474
  }
467
475
  ]
468
476
  },
@@ -520,6 +528,10 @@
520
528
  {
521
529
  "type": "SYMBOL",
522
530
  "name": "event_decl"
531
+ },
532
+ {
533
+ "type": "SYMBOL",
534
+ "name": "asset_decl"
523
535
  }
524
536
  ]
525
537
  },
@@ -1246,6 +1258,60 @@
1246
1258
  }
1247
1259
  ]
1248
1260
  },
1261
+ "asset_decl": {
1262
+ "type": "SEQ",
1263
+ "members": [
1264
+ {
1265
+ "type": "STRING",
1266
+ "value": "asset"
1267
+ },
1268
+ {
1269
+ "type": "FIELD",
1270
+ "name": "name",
1271
+ "content": {
1272
+ "type": "SYMBOL",
1273
+ "name": "identifier"
1274
+ }
1275
+ },
1276
+ {
1277
+ "type": "STRING",
1278
+ "value": "="
1279
+ },
1280
+ {
1281
+ "type": "FIELD",
1282
+ "name": "path",
1283
+ "content": {
1284
+ "type": "SYMBOL",
1285
+ "name": "string_literal"
1286
+ }
1287
+ },
1288
+ {
1289
+ "type": "CHOICE",
1290
+ "members": [
1291
+ {
1292
+ "type": "SEQ",
1293
+ "members": [
1294
+ {
1295
+ "type": "STRING",
1296
+ "value": "at"
1297
+ },
1298
+ {
1299
+ "type": "FIELD",
1300
+ "name": "at",
1301
+ "content": {
1302
+ "type": "SYMBOL",
1303
+ "name": "string_literal"
1304
+ }
1305
+ }
1306
+ ]
1307
+ },
1308
+ {
1309
+ "type": "BLANK"
1310
+ }
1311
+ ]
1312
+ }
1313
+ ]
1314
+ },
1249
1315
  "sum_type": {
1250
1316
  "type": "PREC_RIGHT",
1251
1317
  "value": 0,
@@ -6052,6 +6118,22 @@
6052
6118
  "name": "_expression"
6053
6119
  }
6054
6120
  },
6121
+ {
6122
+ "type": "CHOICE",
6123
+ "members": [
6124
+ {
6125
+ "type": "FIELD",
6126
+ "name": "principal",
6127
+ "content": {
6128
+ "type": "SYMBOL",
6129
+ "name": "call_site_actor"
6130
+ }
6131
+ },
6132
+ {
6133
+ "type": "BLANK"
6134
+ }
6135
+ ]
6136
+ },
6055
6137
  {
6056
6138
  "type": "STRING",
6057
6139
  "value": "faults"
@@ -8173,6 +8255,26 @@
8173
8255
  }
8174
8256
  ]
8175
8257
  }
8258
+ },
8259
+ "doc_line": {
8260
+ "type": "TOKEN",
8261
+ "content": {
8262
+ "type": "PREC",
8263
+ "value": 1,
8264
+ "content": {
8265
+ "type": "SEQ",
8266
+ "members": [
8267
+ {
8268
+ "type": "STRING",
8269
+ "value": "--|"
8270
+ },
8271
+ {
8272
+ "type": "PATTERN",
8273
+ "value": "[^\\n]*"
8274
+ }
8275
+ ]
8276
+ }
8277
+ }
8176
8278
  }
8177
8279
  },
8178
8280
  "extras": [
@@ -8180,6 +8282,10 @@
8180
8282
  "type": "PATTERN",
8181
8283
  "value": "\\s+"
8182
8284
  },
8285
+ {
8286
+ "type": "SYMBOL",
8287
+ "name": "doc_line"
8288
+ },
8183
8289
  {
8184
8290
  "type": "SYMBOL",
8185
8291
  "name": "line_comment"
@@ -236,6 +236,10 @@
236
236
  "type": "agent_decl",
237
237
  "named": true
238
238
  },
239
+ {
240
+ "type": "asset_decl",
241
+ "named": true
242
+ },
239
243
  {
240
244
  "type": "binding_decl",
241
245
  "named": true
@@ -537,6 +541,42 @@
537
541
  }
538
542
  }
539
543
  },
544
+ {
545
+ "type": "asset_decl",
546
+ "named": true,
547
+ "fields": {
548
+ "at": {
549
+ "multiple": false,
550
+ "required": false,
551
+ "types": [
552
+ {
553
+ "type": "string_literal",
554
+ "named": true
555
+ }
556
+ ]
557
+ },
558
+ "name": {
559
+ "multiple": false,
560
+ "required": true,
561
+ "types": [
562
+ {
563
+ "type": "identifier",
564
+ "named": true
565
+ }
566
+ ]
567
+ },
568
+ "path": {
569
+ "multiple": false,
570
+ "required": true,
571
+ "types": [
572
+ {
573
+ "type": "string_literal",
574
+ "named": true
575
+ }
576
+ ]
577
+ }
578
+ }
579
+ },
540
580
  {
541
581
  "type": "assign_stmt",
542
582
  "named": true,
@@ -1809,6 +1849,10 @@
1809
1849
  "type": "agent_decl",
1810
1850
  "named": true
1811
1851
  },
1852
+ {
1853
+ "type": "asset_decl",
1854
+ "named": true
1855
+ },
1812
1856
  {
1813
1857
  "type": "capability_decl",
1814
1858
  "named": true
@@ -1907,6 +1951,10 @@
1907
1951
  "type": "agent_decl",
1908
1952
  "named": true
1909
1953
  },
1954
+ {
1955
+ "type": "asset_decl",
1956
+ "named": true
1957
+ },
1910
1958
  {
1911
1959
  "type": "capability_decl",
1912
1960
  "named": true
@@ -3612,6 +3660,16 @@
3612
3660
  "named": true
3613
3661
  }
3614
3662
  ]
3663
+ },
3664
+ "principal": {
3665
+ "multiple": false,
3666
+ "required": false,
3667
+ "types": [
3668
+ {
3669
+ "type": "call_site_actor",
3670
+ "named": true
3671
+ }
3672
+ ]
3615
3673
  }
3616
3674
  }
3617
3675
  },
@@ -8958,6 +9016,10 @@
8958
9016
  "type": "agent_decl",
8959
9017
  "named": true
8960
9018
  },
9019
+ {
9020
+ "type": "asset_decl",
9021
+ "named": true
9022
+ },
8961
9023
  {
8962
9024
  "type": "assign_stmt",
8963
9025
  "named": true
@@ -11271,6 +11333,14 @@
11271
11333
  "type": "as",
11272
11334
  "named": false
11273
11335
  },
11336
+ {
11337
+ "type": "asset",
11338
+ "named": false
11339
+ },
11340
+ {
11341
+ "type": "at",
11342
+ "named": false
11343
+ },
11274
11344
  {
11275
11345
  "type": "auth",
11276
11346
  "named": false
@@ -11344,6 +11414,11 @@
11344
11414
  "named": true,
11345
11415
  "extra": true
11346
11416
  },
11417
+ {
11418
+ "type": "doc_line",
11419
+ "named": true,
11420
+ "extra": true
11421
+ },
11347
11422
  {
11348
11423
  "type": "each",
11349
11424
  "named": false