tree-sitter-bynk 0.371.3 → 0.377.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 CHANGED
@@ -39,7 +39,7 @@ const PREC = {
39
39
  module.exports = grammar({
40
40
  name: "bynk",
41
41
 
42
- externals: ($) => [$.doc_block],
42
+ externals: ($) => [$.doc_block, $.doc_line],
43
43
 
44
44
  extras: ($) => [/\s+/, $.doc_line, $.line_comment, $.doc_block],
45
45
 
@@ -1781,7 +1781,15 @@ module.exports = grammar({
1781
1781
  string_literal: ($) =>
1782
1782
  seq(
1783
1783
  '"',
1784
- repeat(choice(/[^"\\\n]/, /\\[nt"\\]/, $.string_interpolation)),
1784
+ // #2203: string text is one high-precedence immediate token, so a
1785
+ // `//` inside a string (a URL) is text, not a line comment.
1786
+ repeat(
1787
+ choice(
1788
+ token.immediate(prec(1, /[^"\\\n]+/)),
1789
+ /\\[nt"\\]/,
1790
+ $.string_interpolation,
1791
+ ),
1792
+ ),
1785
1793
  '"',
1786
1794
  ),
1787
1795
  // v0.43: an interpolation hole `\(expr)`. A bare `\(` was an invalid
@@ -1791,21 +1799,13 @@ module.exports = grammar({
1791
1799
  boolean_literal: () => choice("true", "false"),
1792
1800
  unit_literal: () => seq("(", ")"),
1793
1801
 
1794
- // `--` line comment. The external scanner consumes `---+`-starting
1795
- // lines as `doc_block` tokens before the regex tokenizer runs, so
1796
- // line_comment sees only `--` (or `-` chars followed by a non-third
1797
- // dash sequence that's already been gobbled by the external scanner).
1798
- line_comment: () => token(seq("--", /[^\n]*/)),
1799
-
1800
- // #1888: a `--|` one-line doc. Both it and `line_comment` match a
1801
- // `--|` line to its end, so the higher lexical precedence makes it a
1802
- // doc. The compiler takes `--|` as a doc only when it is the first thing
1803
- // on its line; an extras token cannot see that, so a `--|` after code on
1804
- // the same line highlights as a doc here though it compiles as a comment.
1805
- doc_line: () => token(prec(1, seq("--|", /[^\n]*/))),
1806
-
1807
- // `doc_block` is provided by the external scanner — see src/scanner.c.
1808
- // The grammar references it via the `externals` array above.
1802
+ // #2203: a `//` line comment, anywhere. There is no prefix `/`, so
1803
+ // `a//b` cannot mean anything else.
1804
+ line_comment: () => token(seq("//", /[^\n]*/)),
1805
+
1806
+ // `doc_block` and `doc_line` (#2203: a `--- text` one-line doc, first on
1807
+ // its line) are provided by the external scanner — see src/scanner.c. The
1808
+ // grammar references them via the `externals` array above.
1809
1809
  },
1810
1810
  });
1811
1811
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tree-sitter-bynk",
3
- "version": "0.371.3",
3
+ "version": "0.377.2",
4
4
  "description": "Tree-sitter grammar for the Bynk language.",
5
5
  "main": "bindings/node",
6
6
  "types": "bindings/node",
package/src/grammar.json CHANGED
@@ -8670,8 +8670,15 @@
8670
8670
  "type": "CHOICE",
8671
8671
  "members": [
8672
8672
  {
8673
- "type": "PATTERN",
8674
- "value": "[^\"\\\\\\n]"
8673
+ "type": "IMMEDIATE_TOKEN",
8674
+ "content": {
8675
+ "type": "PREC",
8676
+ "value": 1,
8677
+ "content": {
8678
+ "type": "PATTERN",
8679
+ "value": "[^\"\\\\\\n]+"
8680
+ }
8681
+ }
8675
8682
  },
8676
8683
  {
8677
8684
  "type": "PATTERN",
@@ -8740,7 +8747,7 @@
8740
8747
  "members": [
8741
8748
  {
8742
8749
  "type": "STRING",
8743
- "value": "--"
8750
+ "value": "//"
8744
8751
  },
8745
8752
  {
8746
8753
  "type": "PATTERN",
@@ -8748,26 +8755,6 @@
8748
8755
  }
8749
8756
  ]
8750
8757
  }
8751
- },
8752
- "doc_line": {
8753
- "type": "TOKEN",
8754
- "content": {
8755
- "type": "PREC",
8756
- "value": 1,
8757
- "content": {
8758
- "type": "SEQ",
8759
- "members": [
8760
- {
8761
- "type": "STRING",
8762
- "value": "--|"
8763
- },
8764
- {
8765
- "type": "PATTERN",
8766
- "value": "[^\\n]*"
8767
- }
8768
- ]
8769
- }
8770
- }
8771
8758
  }
8772
8759
  },
8773
8760
  "extras": [
@@ -8822,6 +8809,10 @@
8822
8809
  {
8823
8810
  "type": "SYMBOL",
8824
8811
  "name": "doc_block"
8812
+ },
8813
+ {
8814
+ "type": "SYMBOL",
8815
+ "name": "doc_line"
8825
8816
  }
8826
8817
  ],
8827
8818
  "inline": [],