Skip to content

Commit 34c2b44

Browse files
authored
Update PHP and PHPDoc grammars (#89)
To v0.24.2 and v0.1.7 respectively. Enables features of PHP 8.4 and 8.5. - tree-sitter/tree-sitter-php#275 - `php_end_tag` was added - `callable` is no longer a keyword - tree-sitter/tree-sitter-php#237 - `string_value` was replaced with `string_content` - `modifier` field was removed from `class_declaration` - Various - `yield` and `from` are converted to `yield` and `yield from`
1 parent 11e54a5 commit 34c2b44

4 files changed

Lines changed: 21 additions & 18 deletions

File tree

extension.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ language = "PHP"
2424

2525
[grammars.php]
2626
repository = "https://github.com/tree-sitter/tree-sitter-php"
27-
commit = "8ab93274065cbaf529ea15c24360cfa3348ec9e4"
27+
commit = "5b5627faaa290d89eb3d01b9bf47c3bb9e797dea"
2828
path = "php"
2929

3030
[grammars.phpdoc]
3131
repository = "https://github.com/claytonrcarter/tree-sitter-phpdoc"
32-
commit = "03bb10330704b0b371b044e937d5cc7cd40b4999"
32+
commit = "488198e61f49fc74ee54069a4126b556665a57cc"

languages/php/highlights.scm

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(php_tag) @tag
2-
"?>" @tag
2+
(php_end_tag) @tag
33

44
; Types
55

@@ -80,7 +80,7 @@
8080
; Basic tokens
8181
[
8282
(string)
83-
(string_value)
83+
(string_content)
8484
(encapsed_string)
8585
(heredoc)
8686
(heredoc_body)
@@ -170,7 +170,6 @@
170170
"and" @keyword
171171
"as" @keyword
172172
"break" @keyword
173-
"callable" @keyword
174173
"case" @keyword
175174
"catch" @keyword
176175
"class" @keyword
@@ -197,7 +196,6 @@
197196
"for" @keyword
198197
"foreach" @keyword
199198
"fn" @keyword
200-
"from" @keyword
201199
"function" @keyword
202200
"global" @keyword
203201
"goto" @keyword
@@ -229,3 +227,4 @@
229227
"while" @keyword
230228
"xor" @keyword
231229
"yield" @keyword
230+
"yield from" @keyword

languages/php/outline.scm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
.
3737
(argument
3838
[
39-
(encapsed_string (string_value) @name)
40-
(string (string_value) @name)
39+
(encapsed_string (string_content) @name)
40+
(string (string_content) @name)
4141
]
4242
)
4343
)

languages/php/runnables.scm

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
; and the method is public
55
(
66
(class_declaration
7-
modifier: (_)? @_modifier
8-
(#not-eq? @_modifier "abstract")
7+
(_)* @_modifier
8+
(#not-any-eq? @_modifier "abstract")
9+
.
910
name: (_) @_name
1011
(#match? @_name ".*Test$")
1112
body: (declaration_list
@@ -26,8 +27,9 @@
2627
; and the method is public
2728
(
2829
(class_declaration
29-
modifier: (_)? @_modifier
30-
(#not-eq? @_modifier "abstract")
30+
(_)* @_modifier
31+
(#not-any-eq? @_modifier "abstract")
32+
.
3133
name: (_) @_name
3234
(#match? @_name ".*Test$")
3335
body: (declaration_list
@@ -51,8 +53,9 @@
5153
; and the method is public
5254
(
5355
(class_declaration
54-
modifier: (_)? @_modifier
55-
(#not-eq? @_modifier "abstract")
56+
(_)* @_modifier
57+
(#not-any-eq? @_modifier "abstract")
58+
.
5659
name: (_) @_name
5760
(#match? @_name ".*Test$")
5861
body: (declaration_list
@@ -77,8 +80,9 @@
7780
; and that doesn't have the abstract modifier
7881
(
7982
(class_declaration
80-
modifier: (_)? @_modifier
81-
(#not-eq? @_modifier "abstract")
83+
(_)* @_modifier
84+
(#not-any-eq? @_modifier "abstract")
85+
.
8286
name: (_) @run
8387
(#match? @run ".*Test$")
8488
) @_phpunit-test
@@ -95,8 +99,8 @@
9599
.
96100
(argument
97101
[
98-
(encapsed_string (string_value) @run)
99-
(string (string_value) @run)
102+
(encapsed_string (string_content) @run)
103+
(string (string_content) @run)
100104
]
101105
)
102106
)

0 commit comments

Comments
 (0)