@willbooster/tree-sitter-php 1.0.0 → 1.0.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/README.md CHANGED
@@ -10,8 +10,8 @@ PHP grammars for [tree-sitter](https://github.com/tree-sitter/tree-sitter), fork
10
10
  [tree-sitter/tree-sitter-php](https://github.com/tree-sitter/tree-sitter-php). We are grateful
11
11
  to its authors and contributors. This is not an official release of that project.
12
12
 
13
- This fork keeps the grammars and the queries of upstream's version 0.24.2, and its scanner except for one statement
14
- adapted to the `tree_sitter/array.h` that the generator writes. It generates the parsers with the
13
+ This fork keeps the grammars and the queries of upstream's version 0.24.2. Its external scanner adapts to the generated
14
+ array API and fixes incremental heredoc parsing. It generates the parsers with the
15
15
  [WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parsers carry that fork's own ABI
16
16
  number, so they load only with its runtime (`willbooster-tree-sitter`, `@willbooster/web-tree-sitter`), version 2.0.0
17
17
  or later, and that runtime loads no parser that upstream's generator wrote.
@@ -104,6 +104,7 @@ module.exports = function defineGrammar(dialect) {
104
104
  $.heredoc_start,
105
105
  $.heredoc_end,
106
106
  $.nowdoc_string,
107
+ $._heredoc_line_start,
107
108
  $.sentinel_error, // Unused token used to indicate error recovery mode
108
109
  ],
109
110
 
@@ -1457,9 +1458,9 @@ module.exports = function defineGrammar(dialect) {
1457
1458
  string_content: _ => prec.right(repeat1(token.immediate(prec(1, /\\?[^'\\]+/)))),
1458
1459
 
1459
1460
  heredoc_body: $ => seq(
1460
- $._new_line,
1461
+ $._heredoc_new_line,
1461
1462
  repeat1(prec.right(seq(
1462
- optional($._new_line),
1463
+ optional($._heredoc_new_line),
1463
1464
  $._interpolated_string_body_heredoc,
1464
1465
  ))),
1465
1466
  ),
@@ -1472,13 +1473,15 @@ module.exports = function defineGrammar(dialect) {
1472
1473
  choice(
1473
1474
  seq(
1474
1475
  field('value', $.heredoc_body),
1475
- $._new_line,
1476
+ $._heredoc_new_line,
1476
1477
  ),
1477
1478
  field('value', optional($.heredoc_body)),
1478
1479
  ),
1479
1480
  field('end_tag', $.heredoc_end),
1480
1481
  ),
1481
1482
 
1483
+ _heredoc_new_line: $ => seq($._new_line, $._heredoc_line_start),
1484
+
1482
1485
  _new_line: _ => /\r?\n|\r/,
1483
1486
 
1484
1487
  nowdoc_body: $ => seq(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-php",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "PHP grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
Binary file
package/tree-sitter.json CHANGED
@@ -33,7 +33,7 @@
33
33
  }
34
34
  ],
35
35
  "metadata": {
36
- "version": "1.0.0",
36
+ "version": "1.0.2",
37
37
  "license": "MIT",
38
38
  "description": "PHP grammar for tree-sitter",
39
39
  "authors": [