Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit accafea

Browse files
Ben3eeEclaytonrcarter
authored andcommitted
Add more scopes
Fixes scopes of anonymous nodes Scopes constant.language.php for language constants Scope the class of catch expressions as a class name Change object_creation_expression to scope as entity.name.type.class
1 parent e85ab96 commit accafea

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

grammars/tree-sitter-php.cson

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ scopes:
6161
'member_access_expression > name': 'variable.other.object.property'
6262

6363
'class_declaration > name': 'entity.name.type.class'
64+
'catch_clause > qualified_name > name': 'entity.name.type.class'
6465
'class_base_clause > qualified_name > name': 'entity.other.inherited-class'
6566

67+
'qualified_name > name': {match: /^(TRUE|FALSE|NULL|__(FILE|DIR|FUNCTION|CLASS|METHOD|LINE|NAMESPACE)__|ON|OFF|YES|NO|NL|BR|TAB)$/i, scopes: 'constant.language.php'}
68+
6669
'interface_declaration > name': 'entity.name.type.interface'
6770
'class_interface_clause > qualified_name > name': 'entity.other.implemented-interface'
6871

@@ -77,7 +80,7 @@ scopes:
7780
'method_declaration > function_definition > name': 'entity.name.function'
7881
'constructor_definition > "__construct"': 'entity.name.function'
7982

80-
'object_creation_expression > qualified_name > name': 'meta.class.instance.constructor'
83+
'object_creation_expression > qualified_name > name': 'entity.name.type.class'
8184
'object_creation_expression > new_variable > simple_variable': 'meta.class.instance.constructor'
8285

8386
'const_element > name': 'constant'
@@ -90,10 +93,14 @@ scopes:
9093
'false': 'constant.language.boolean.false'
9194
'comment': 'comment.block'
9295

93-
'"("': 'punctuation.definition.parameters.begin.bracket.round'
94-
'")"': 'punctuation.definition.parameters.end.bracket.round'
95-
'"{"': 'punctuation.definition.function.body.begin.bracket.curly'
96-
'"}"': 'punctuation.definition.function.body.end.bracket.curly'
96+
'variable_name > "$"': 'punctuation.definition.variable.php'
97+
'"("': 'punctuation.definition.parameters.begin.bracket.round.php'
98+
'")"': 'punctuation.definition.parameters.end.bracket.round.php'
99+
'"{"': 'punctuation.definition.begin.bracket.curly.php'
100+
'"}"': 'punctuation.definition.end.bracket.curly.php'
101+
'"["': 'punctuation.section.array.begin.php'
102+
'"]"': 'punctuation.section.array.end.php'
103+
'";"': 'punctuation.terminator.expression.php'
97104

98105
'"static"': 'storage.modifier'
99106
'"public"': 'storage.modifier'
@@ -160,8 +167,8 @@ scopes:
160167
'"insteadof"': 'keyword.insteadof'
161168
'"instanceof"': 'keyword.type'
162169

163-
'"->"': 'meta.delimiter.property.arrow'
164-
'","': 'meta.delimiter.object.comma'
170+
'"->"': 'keyword.operator.class'
171+
'","': 'punctuation.separator.delimiter.php'
165172

166173
'"if"': 'keyword.control'
167174
'"do"': 'keyword.control'

0 commit comments

Comments
 (0)