2021-04-09 10:42:49 +02:00
|
|
|
(php_tag) @tag
|
|
|
|
"?>" @tag
|
|
|
|
|
|
|
|
; Types
|
2023-03-08 01:28:44 +01:00
|
|
|
[
|
|
|
|
(primitive_type)
|
|
|
|
(cast_type)
|
|
|
|
] @type.builtin
|
|
|
|
|
|
|
|
(named_type
|
|
|
|
[ (name) @type
|
|
|
|
(qualified_name (name) @type)])
|
|
|
|
|
|
|
|
(base_clause
|
|
|
|
[ (name) @type
|
|
|
|
(qualified_name (name) @type)])
|
|
|
|
|
|
|
|
(enum_declaration
|
|
|
|
name: (name) @type.enum)
|
2021-04-09 10:42:49 +02:00
|
|
|
|
2023-03-08 01:28:44 +01:00
|
|
|
(interface_declaration
|
|
|
|
name: (name) @constructor)
|
|
|
|
|
|
|
|
(class_declaration
|
|
|
|
name: (name) @constructor)
|
|
|
|
|
|
|
|
(trait_declaration
|
|
|
|
name:(name) @constructor)
|
2021-04-09 10:42:49 +02:00
|
|
|
|
2022-08-05 14:34:03 +02:00
|
|
|
(namespace_definition
|
|
|
|
name: (namespace_name (name) @namespace))
|
|
|
|
|
2023-03-08 01:28:44 +01:00
|
|
|
(namespace_name_as_prefix
|
|
|
|
(namespace_name (name) @namespace))
|
|
|
|
|
|
|
|
(namespace_use_clause
|
|
|
|
[ (name) @namespace
|
|
|
|
(qualified_name (name) @type) ])
|
|
|
|
|
|
|
|
(namespace_aliasing_clause (name) @namespace)
|
|
|
|
|
|
|
|
(class_interface_clause
|
|
|
|
[(name) @type
|
|
|
|
(qualified_name (name) @type)])
|
|
|
|
|
|
|
|
(scoped_call_expression
|
|
|
|
scope: [(name) @type
|
|
|
|
(qualified_name (name) @type)])
|
|
|
|
|
|
|
|
(class_constant_access_expression
|
|
|
|
. [(name) @constructor
|
|
|
|
(qualified_name (name) @constructor)]
|
|
|
|
(name) @constant)
|
|
|
|
|
|
|
|
(use_declaration (name) @type)
|
|
|
|
|
|
|
|
(binary_expression
|
|
|
|
operator: "instanceof"
|
|
|
|
right: [(name) @type
|
|
|
|
(qualified_name (name) @type)])
|
|
|
|
|
2022-08-05 14:34:03 +02:00
|
|
|
; Superglobals
|
|
|
|
(subscript_expression
|
|
|
|
(variable_name(name) @constant.builtin
|
|
|
|
(#match? @constant.builtin "^_?[A-Z][A-Z\\d_]+$")))
|
|
|
|
|
2021-04-09 10:42:49 +02:00
|
|
|
; Functions
|
|
|
|
|
|
|
|
(array_creation_expression "array" @function.builtin)
|
|
|
|
(list_literal "list" @function.builtin)
|
|
|
|
|
|
|
|
(method_declaration
|
|
|
|
name: (name) @function.method)
|
|
|
|
|
|
|
|
(function_call_expression
|
2022-08-05 14:34:03 +02:00
|
|
|
function: (_) @function)
|
2021-04-09 10:42:49 +02:00
|
|
|
|
|
|
|
(scoped_call_expression
|
|
|
|
name: (name) @function)
|
|
|
|
|
|
|
|
(member_call_expression
|
|
|
|
name: (name) @function.method)
|
|
|
|
|
|
|
|
(function_definition
|
|
|
|
name: (name) @function)
|
|
|
|
|
2023-03-08 01:28:44 +01:00
|
|
|
(nullsafe_member_call_expression
|
|
|
|
name: (name) @function.method)
|
|
|
|
|
|
|
|
(object_creation_expression
|
|
|
|
[(name) @constructor
|
|
|
|
(qualified_name (name) @constructor)])
|
|
|
|
|
|
|
|
; Parameters
|
|
|
|
[
|
|
|
|
(simple_parameter)
|
|
|
|
(variadic_parameter)
|
|
|
|
] @variable.parameter
|
|
|
|
|
|
|
|
(argument
|
|
|
|
(name) @variable.parameter)
|
2022-08-05 14:34:03 +02:00
|
|
|
|
2021-04-09 10:42:49 +02:00
|
|
|
; Member
|
|
|
|
|
|
|
|
(property_element
|
2021-11-03 04:00:52 +01:00
|
|
|
(variable_name) @variable.other.member)
|
2021-04-09 10:42:49 +02:00
|
|
|
|
|
|
|
(member_access_expression
|
2021-11-03 04:00:52 +01:00
|
|
|
name: (variable_name (name)) @variable.other.member)
|
2021-04-09 10:42:49 +02:00
|
|
|
(member_access_expression
|
2021-11-03 04:00:52 +01:00
|
|
|
name: (name) @variable.other.member)
|
2021-04-09 10:42:49 +02:00
|
|
|
|
|
|
|
; Variables
|
|
|
|
|
|
|
|
(relative_scope) @variable.builtin
|
|
|
|
|
|
|
|
((name) @constant
|
2021-10-16 11:02:06 +02:00
|
|
|
(#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
|
2021-04-09 10:42:49 +02:00
|
|
|
|
|
|
|
((name) @constructor
|
|
|
|
(#match? @constructor "^[A-Z]"))
|
|
|
|
|
|
|
|
((name) @variable.builtin
|
|
|
|
(#eq? @variable.builtin "this"))
|
|
|
|
|
|
|
|
(variable_name) @variable
|
|
|
|
|
2023-03-08 01:28:44 +01:00
|
|
|
; Attributes
|
|
|
|
(attribute_list) @attribute
|
|
|
|
|
2021-04-09 10:42:49 +02:00
|
|
|
; Basic tokens
|
|
|
|
|
2023-03-08 01:28:44 +01:00
|
|
|
[
|
|
|
|
(string)
|
|
|
|
(encapsed_string)
|
|
|
|
(heredoc_body)
|
|
|
|
(nowdoc_body)
|
|
|
|
(shell_command_expression)
|
|
|
|
] @string
|
|
|
|
(escape_sequence) @constant.character.escape
|
|
|
|
|
2021-11-03 04:00:52 +01:00
|
|
|
(boolean) @constant.builtin.boolean
|
2021-04-09 10:42:49 +02:00
|
|
|
(null) @constant.builtin
|
2021-11-03 04:00:52 +01:00
|
|
|
(integer) @constant.numeric.integer
|
|
|
|
(float) @constant.numeric.float
|
2021-04-09 10:42:49 +02:00
|
|
|
(comment) @comment
|
|
|
|
|
2023-03-08 01:28:44 +01:00
|
|
|
(goto_statement (name) @label)
|
|
|
|
(named_label_statement (name) @label)
|
2021-04-09 10:42:49 +02:00
|
|
|
|
|
|
|
; Keywords
|
|
|
|
|
2022-08-05 14:34:03 +02:00
|
|
|
[
|
|
|
|
"default"
|
|
|
|
"echo"
|
|
|
|
"enum"
|
|
|
|
"extends"
|
|
|
|
"final"
|
2023-03-08 01:28:44 +01:00
|
|
|
"goto"
|
2022-08-05 14:34:03 +02:00
|
|
|
"global"
|
|
|
|
"implements"
|
|
|
|
"insteadof"
|
|
|
|
"new"
|
|
|
|
"private"
|
|
|
|
"protected"
|
|
|
|
"public"
|
2023-03-14 01:21:44 +01:00
|
|
|
"clone"
|
|
|
|
"unset"
|
2023-03-08 01:28:44 +01:00
|
|
|
] @keyword
|
|
|
|
|
|
|
|
[
|
|
|
|
"if"
|
|
|
|
"else"
|
|
|
|
"elseif"
|
|
|
|
"endif"
|
|
|
|
"switch"
|
|
|
|
"endswitch"
|
|
|
|
"case"
|
|
|
|
"match"
|
|
|
|
"declare"
|
|
|
|
"enddeclare"
|
|
|
|
"??"
|
|
|
|
] @keyword.control.conditional
|
|
|
|
|
|
|
|
[
|
|
|
|
"for"
|
|
|
|
"endfor"
|
|
|
|
"foreach"
|
|
|
|
"endforeach"
|
|
|
|
"while"
|
|
|
|
"endwhile"
|
|
|
|
"do"
|
|
|
|
] @keyword.control.repeat
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
"include_once"
|
|
|
|
"include"
|
2022-08-05 14:34:03 +02:00
|
|
|
"require_once"
|
|
|
|
"require"
|
2023-03-08 01:28:44 +01:00
|
|
|
"use"
|
|
|
|
] @keyword.control.import
|
|
|
|
|
|
|
|
[
|
2022-08-05 14:34:03 +02:00
|
|
|
"return"
|
2023-03-08 01:28:44 +01:00
|
|
|
"break"
|
|
|
|
"continue"
|
|
|
|
"yield"
|
|
|
|
] @keyword.control.return
|
|
|
|
|
|
|
|
[
|
2022-08-05 14:34:03 +02:00
|
|
|
"throw"
|
|
|
|
"try"
|
2023-03-08 01:28:44 +01:00
|
|
|
"catch"
|
|
|
|
"finally"
|
|
|
|
] @keyword.control.exception
|
|
|
|
|
|
|
|
[
|
|
|
|
"as"
|
|
|
|
"or"
|
|
|
|
"xor"
|
|
|
|
"and"
|
|
|
|
"instanceof"
|
|
|
|
] @keyword.operator
|
|
|
|
|
|
|
|
[
|
|
|
|
"fn"
|
|
|
|
"function"
|
|
|
|
] @keyword.function
|
|
|
|
|
|
|
|
[
|
|
|
|
"namespace"
|
|
|
|
"class"
|
|
|
|
"interface"
|
|
|
|
"trait"
|
|
|
|
"abstract"
|
|
|
|
] @keyword.storage.type
|
|
|
|
|
|
|
|
[
|
|
|
|
"static"
|
|
|
|
"const"
|
|
|
|
] @keyword.storage.modifier
|
|
|
|
|
|
|
|
[
|
|
|
|
","
|
|
|
|
";"
|
|
|
|
":"
|
|
|
|
"\\"
|
|
|
|
] @punctuation.delimiter
|
|
|
|
|
|
|
|
[
|
|
|
|
(php_tag)
|
|
|
|
"?>"
|
|
|
|
"("
|
|
|
|
")"
|
|
|
|
"["
|
|
|
|
"]"
|
|
|
|
"{"
|
|
|
|
"}"
|
|
|
|
"#["
|
|
|
|
] @punctuation.bracket
|
|
|
|
|
|
|
|
[
|
|
|
|
"="
|
|
|
|
|
|
|
|
"."
|
|
|
|
"-"
|
|
|
|
"*"
|
|
|
|
"/"
|
|
|
|
"+"
|
|
|
|
"%"
|
|
|
|
"**"
|
|
|
|
|
|
|
|
"~"
|
|
|
|
"|"
|
|
|
|
"^"
|
|
|
|
"&"
|
|
|
|
"<<"
|
|
|
|
">>"
|
|
|
|
|
|
|
|
"->"
|
|
|
|
"?->"
|
|
|
|
|
|
|
|
"=>"
|
|
|
|
|
|
|
|
"<"
|
|
|
|
"<="
|
|
|
|
">="
|
|
|
|
">"
|
|
|
|
"<>"
|
|
|
|
"=="
|
|
|
|
"!="
|
|
|
|
"==="
|
|
|
|
"!=="
|
|
|
|
|
|
|
|
"!"
|
|
|
|
"&&"
|
|
|
|
"||"
|
|
|
|
|
|
|
|
".="
|
|
|
|
"-="
|
|
|
|
"+="
|
|
|
|
"*="
|
|
|
|
"/="
|
|
|
|
"%="
|
|
|
|
"**="
|
|
|
|
"&="
|
|
|
|
"|="
|
|
|
|
"^="
|
|
|
|
"<<="
|
|
|
|
">>="
|
|
|
|
"??="
|
|
|
|
"--"
|
|
|
|
"++"
|
|
|
|
|
|
|
|
"@"
|
|
|
|
"::"
|
|
|
|
] @operator
|