-
-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tree-sitter fixes for December (including a PHP grammar!) #852
Changes from 1 commit
a8f5b17
a1e9fa0
daf0637
818d204
037377a
1ed79e2
fdc70fc
20a64bd
be37b26
f6bb61f
da10036
bc55c4f
7b4a50d
66aea45
294134c
ee54d37
d6f8a3c
00de52c
1dc1536
0fd47f5
ee3f41e
3a4b2dc
8ae599f
b6d88a5
18788c0
f6e1a22
5e62e20
0807dcf
bbf4cb4
351493f
bf039cc
ebd0ae0
e2da555
70b34cd
a40bae4
30f696f
9db2ace
0e8fe9b
a42d0ed
d32bdf6
d9f6946
0b51a77
aef7c84
b7dc654
d148a73
c93bdeb
ad8a215
58b9cc1
8c946a0
f2dabe5
2580642
8836be7
0b08306
336f609
c50b0e6
4c6b0ba
254440e
50bfa51
865153b
ddfa645
9972245
a34b01b
e78feea
62bd6cc
f3be33b
bae3689
6ebdfa0
0111e13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -245,15 +245,60 @@ | |
(class_declaration (base_clause (name) @entity.other.inherited-class.php)) | ||
(class_declaration (class_interface_clause (name) @entity.other.implemented-interface.php)) | ||
|
||
; Static method calls. | ||
; The "Foo" and "Bar" in `use Bar, Foo;` | ||
(use_declaration (name) @support.other.trait.php) | ||
|
||
; The "Foo" in `Baz::thud insteadof Foo;` | ||
(use_instead_of_clause (name) @support.other.trait.php . | ||
(#set! capture.final true)) | ||
|
||
; In `use` lists, the "bar" in `Foo::bar` is a method, not a constant. | ||
(use_list | ||
(_ | ||
(class_constant_access_expression (name) @support.other.function.method.php .) | ||
) | ||
(#set! capture.final true)) | ||
|
||
; The "Foo" and "bar" in `Foo::bar`. | ||
(class_constant_access_expression . (name) @support.class.php) | ||
(class_constant_access_expression (name) @support.other.property.php .) | ||
|
||
; The "Foo" and "bar" in "Foo::bar()". | ||
(scoped_call_expression | ||
scope: (name) @support.class.php | ||
name: (name) @support.other.function.method.static.php) | ||
|
||
; The "Foo" and "$bar" in "Foo::$bar()". | ||
(scoped_call_expression | ||
scope: (name) @support.class.php) | ||
(scoped_call_expression | ||
name: (variable_name) @variable.other.method.static.php) | ||
|
||
; The "Foo" and "$bar" in `Foo::$bar`. | ||
(scoped_property_access_expression | ||
scope: (name) @support.class.php) | ||
(scoped_property_access_expression | ||
name: (variable_name) @variable.other.property.static.php | ||
(#set! capture.final true)) | ||
|
||
; The "bar" in `$foo->bar()`. | ||
(member_call_expression | ||
name: (name) @support.other.function.method.php) | ||
|
||
(scoped_call_expression | ||
scope: (name) @support.class.php) | ||
; The "bar" in `$foo->bar`. | ||
(member_access_expression | ||
name: (name) @support.other.property.php | ||
(#set! capture.final true)) | ||
|
||
; The "$bar" in `$foo->$bar()`. | ||
(member_call_expression | ||
name: (variable_name) @variable.other.method.php | ||
(#set! capture.final true)) | ||
|
||
; The "$bar" in `$foo->$bar`. | ||
(member_access_expression | ||
name: (variable_name) @variable.other.property.php | ||
(#set! capture.final true)) | ||
|
||
|
||
; TRAITS | ||
|
@@ -262,6 +307,12 @@ | |
(trait_declaration (name) @entity.name.type.trait.php) | ||
|
||
|
||
; INTERFACES | ||
; ========== | ||
|
||
(interface_declaration (name) @entity.name.type.interface.php) | ||
|
||
|
||
; TYPES | ||
; ===== | ||
|
||
|
@@ -272,11 +323,22 @@ | |
|
||
"global" @storage.modifier.global.php | ||
|
||
["trait" "class"] @storage.type._TYPE_.php | ||
["enum" "interface" "trait" "class"] @storage.type._TYPE_.php | ||
(enum_case "case" @storage.type.case.php) | ||
"function" @storage.type.function.php | ||
"fn" @storage.type.function.arrow.php | ||
|
||
|
||
; ENUMS | ||
; ===== | ||
|
||
(enum_declaration | ||
name: (name) @entity.name.type.enum.php) | ||
|
||
(enum_declaration_list | ||
(enum_case | ||
name: (name) @constant.other.enum.php)) | ||
|
||
; VARIABLES | ||
; ========= | ||
|
||
|
@@ -300,11 +362,6 @@ | |
"$" @punctuation.definition.variable.php | ||
) @variable.parameter.php)) | ||
|
||
; The "$bar" in `$foo->$bar`. | ||
(member_access_expression | ||
name: (variable_name) @variable.other.property.php | ||
(#set! capture.final true)) | ||
|
||
((variable_name | ||
("$" @punctuation.definition.variable.php) | ||
(name) @_IGNORE_) @variable.other.php | ||
|
@@ -349,10 +406,8 @@ | |
|
||
|
||
[ | ||
"abstract" | ||
"as" | ||
"break" | ||
"case" | ||
"catch" | ||
"const" | ||
"continue" | ||
|
@@ -367,16 +422,12 @@ | |
"endif" | ||
"endswitch" | ||
"endwhile" | ||
"extends" | ||
"finally" | ||
"foreach" | ||
"if" | ||
"implements" | ||
"include_once" | ||
"include" | ||
"insteadof" | ||
"interface" | ||
"namespace" | ||
"new" | ||
"require_once" | ||
"require" | ||
|
@@ -388,8 +439,14 @@ | |
"while" | ||
] @keyword.control._TYPE_.php | ||
|
||
(case_statement "case" @keyword.control.case.php) | ||
|
||
[ | ||
"abstract" | ||
"extends" | ||
"final" | ||
"implements" | ||
"namespace" | ||
"private" | ||
"protected" | ||
"public" | ||
|
@@ -451,7 +508,11 @@ | |
(optional_type "?" @keyword.operator.nullable-type.php) | ||
(union_type "|" @keyword.operator.union-type.php) | ||
|
||
["&&" "||"] @keyword.operator.logical.php | ||
[ | ||
"&&" | ||
"||" | ||
"??" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that this is correct. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And if you agree, then it looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If
|
||
] @keyword.operator.logical.php | ||
|
||
["="] @keyword.operator.assignment.php | ||
|
||
|
@@ -484,7 +545,15 @@ | |
"-=" | ||
"*=" | ||
"/=" | ||
"%=" | ||
"**=" | ||
"&=" | ||
"|=" | ||
"^=" | ||
"<<=" | ||
">>=" | ||
".=" | ||
"??=" | ||
] @keyword.operator.assignment.compound.php | ||
|
||
"->" @keyword.operator.class.php | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question] is this because
namespace
controls how we address the class in usage (eg by changing its namespace)? I would have pegged it more as a keyword (which is how TM scopes it).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
namespace
declares an entity. Just likeclass
orfunction
. If those arestorage
, so isnamespace
.