@willbooster/tree-sitter-php 1.0.4 → 1.1.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/README.md +5 -2
- package/common/define-grammar.js +9 -7
- package/package.json +1 -2
- package/php/src/node-types.json +12 -3
- package/php_only/src/node-types.json +12 -3
- package/tree-sitter-php.wasm +0 -0
- package/tree-sitter-php_only.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
# @willbooster/tree-sitter-php
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@willbooster/tree-sitter-php)
|
|
4
|
+
[](https://www.npmjs.com/package/@willbooster/tree-sitter-php)
|
|
3
5
|
[](https://github.com/WillBooster/tree-sitter-php/actions/workflows/test.yml)
|
|
4
6
|
[](https://github.com/WillBooster/tree-sitter-php/actions/workflows/test-rust.yml)
|
|
5
7
|
[](https://github.com/semantic-release/semantic-release)
|
|
6
|
-
[](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
|
|
7
9
|
[](https://crates.io/crates/willbooster-tree-sitter-php)
|
|
8
10
|
|
|
9
11
|
PHP grammars for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
|
|
10
12
|
[tree-sitter/tree-sitter-php](https://github.com/tree-sitter/tree-sitter-php). We are grateful
|
|
11
13
|
to its authors and contributors. This is not an official release of that project.
|
|
12
14
|
|
|
13
|
-
This fork builds on upstream's version 0.24.2 grammars and queries with support for absolute grouped namespace imports
|
|
15
|
+
This fork builds on upstream's version 0.24.2 grammars and queries with support for absolute grouped namespace imports
|
|
16
|
+
and asymmetric visibility in constructor property promotion.
|
|
14
17
|
Its external scanner adapts to the generated array API and fixes incremental heredoc parsing. It generates the parsers with the
|
|
15
18
|
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parsers carry that fork's own ABI
|
|
16
19
|
number, so they load only with its runtime (`willbooster-tree-sitter`, `@willbooster/web-tree-sitter`), version 2.0.0
|
package/common/define-grammar.js
CHANGED
|
@@ -563,9 +563,11 @@ module.exports = function defineGrammar(dialect) {
|
|
|
563
563
|
|
|
564
564
|
property_promotion_parameter: $ => seq(
|
|
565
565
|
optional(field('attributes', $.attribute_list)),
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
566
|
+
repeat1(choice(
|
|
567
|
+
field('visibility', $.visibility_modifier),
|
|
568
|
+
field('readonly', $.readonly_modifier),
|
|
569
|
+
)),
|
|
570
|
+
optional(field('type', $.type)), // Note: callable is not a valid type here, but instead of complicating the parser, we defer this checking to any intelligence using the parser
|
|
569
571
|
field('name', choice($.by_ref, $.variable_name)),
|
|
570
572
|
optional(seq('=', field('default_value', $.expression))),
|
|
571
573
|
optional($.property_hook_list),
|
|
@@ -1263,12 +1265,11 @@ module.exports = function defineGrammar(dialect) {
|
|
|
1263
1265
|
|
|
1264
1266
|
variadic_placeholder: _ => '...',
|
|
1265
1267
|
|
|
1268
|
+
argument_placeholder: _ => '?',
|
|
1269
|
+
|
|
1266
1270
|
arguments: $ => seq(
|
|
1267
1271
|
'(',
|
|
1268
|
-
optional(choice(
|
|
1269
|
-
seq(commaSep1($.argument), optional(',')),
|
|
1270
|
-
$.variadic_placeholder,
|
|
1271
|
-
)),
|
|
1272
|
+
optional(seq(commaSep1(choice($.argument, $.variadic_placeholder)), optional(','))),
|
|
1272
1273
|
')',
|
|
1273
1274
|
),
|
|
1274
1275
|
|
|
@@ -1279,6 +1280,7 @@ module.exports = function defineGrammar(dialect) {
|
|
|
1279
1280
|
alias($.relative_scope, $.name),
|
|
1280
1281
|
$.variadic_unpacking,
|
|
1281
1282
|
$.expression,
|
|
1283
|
+
$.argument_placeholder,
|
|
1282
1284
|
),
|
|
1283
1285
|
),
|
|
1284
1286
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-php",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "PHP grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
"playwright": "1.64.0",
|
|
60
60
|
"semantic-release": "25.0.9",
|
|
61
61
|
"sort-package-json": "4.0.0",
|
|
62
|
-
"typescript": "7.0.2",
|
|
63
62
|
"vitest": "5.0.3",
|
|
64
63
|
"wrangler": "4.149.0"
|
|
65
64
|
},
|
package/php/src/node-types.json
CHANGED
|
@@ -566,6 +566,10 @@
|
|
|
566
566
|
"multiple": false,
|
|
567
567
|
"required": true,
|
|
568
568
|
"types": [
|
|
569
|
+
{
|
|
570
|
+
"type": "argument_placeholder",
|
|
571
|
+
"named": true
|
|
572
|
+
},
|
|
569
573
|
{
|
|
570
574
|
"type": "expression",
|
|
571
575
|
"named": true
|
|
@@ -581,6 +585,11 @@
|
|
|
581
585
|
]
|
|
582
586
|
}
|
|
583
587
|
},
|
|
588
|
+
{
|
|
589
|
+
"type": "argument_placeholder",
|
|
590
|
+
"named": true,
|
|
591
|
+
"fields": {}
|
|
592
|
+
},
|
|
584
593
|
{
|
|
585
594
|
"type": "arguments",
|
|
586
595
|
"named": true,
|
|
@@ -4188,7 +4197,7 @@
|
|
|
4188
4197
|
]
|
|
4189
4198
|
},
|
|
4190
4199
|
"readonly": {
|
|
4191
|
-
"multiple":
|
|
4200
|
+
"multiple": true,
|
|
4192
4201
|
"required": false,
|
|
4193
4202
|
"types": [
|
|
4194
4203
|
{
|
|
@@ -4208,8 +4217,8 @@
|
|
|
4208
4217
|
]
|
|
4209
4218
|
},
|
|
4210
4219
|
"visibility": {
|
|
4211
|
-
"multiple":
|
|
4212
|
-
"required":
|
|
4220
|
+
"multiple": true,
|
|
4221
|
+
"required": false,
|
|
4213
4222
|
"types": [
|
|
4214
4223
|
{
|
|
4215
4224
|
"type": "visibility_modifier",
|
|
@@ -566,6 +566,10 @@
|
|
|
566
566
|
"multiple": false,
|
|
567
567
|
"required": true,
|
|
568
568
|
"types": [
|
|
569
|
+
{
|
|
570
|
+
"type": "argument_placeholder",
|
|
571
|
+
"named": true
|
|
572
|
+
},
|
|
569
573
|
{
|
|
570
574
|
"type": "expression",
|
|
571
575
|
"named": true
|
|
@@ -581,6 +585,11 @@
|
|
|
581
585
|
]
|
|
582
586
|
}
|
|
583
587
|
},
|
|
588
|
+
{
|
|
589
|
+
"type": "argument_placeholder",
|
|
590
|
+
"named": true,
|
|
591
|
+
"fields": {}
|
|
592
|
+
},
|
|
584
593
|
{
|
|
585
594
|
"type": "arguments",
|
|
586
595
|
"named": true,
|
|
@@ -4188,7 +4197,7 @@
|
|
|
4188
4197
|
]
|
|
4189
4198
|
},
|
|
4190
4199
|
"readonly": {
|
|
4191
|
-
"multiple":
|
|
4200
|
+
"multiple": true,
|
|
4192
4201
|
"required": false,
|
|
4193
4202
|
"types": [
|
|
4194
4203
|
{
|
|
@@ -4208,8 +4217,8 @@
|
|
|
4208
4217
|
]
|
|
4209
4218
|
},
|
|
4210
4219
|
"visibility": {
|
|
4211
|
-
"multiple":
|
|
4212
|
-
"required":
|
|
4220
|
+
"multiple": true,
|
|
4221
|
+
"required": false,
|
|
4213
4222
|
"types": [
|
|
4214
4223
|
{
|
|
4215
4224
|
"type": "visibility_modifier",
|
package/tree-sitter-php.wasm
CHANGED
|
Binary file
|
|
Binary file
|