diff options
Diffstat (limited to 'queries/php.scm')
| -rw-r--r-- | queries/php.scm | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/queries/php.scm b/queries/php.scm new file mode 100644 index 0000000..fc2a5f6 --- /dev/null +++ b/queries/php.scm @@ -0,0 +1,136 @@ +; Keywords + +[ + "and" + "as" + "break" + "case" + "catch" + "class" + "clone" + "const" + "continue" + "declare" + "default" + "do" + "echo" + "else" + "elseif" + "enddeclare" + "endfor" + "endforeach" + "endif" + "endswitch" + "endwhile" + "enum" + "exit" + "extends" + "finally" + "fn" + "for" + "foreach" + "function" + "global" + "goto" + "if" + "implements" + "include" + "include_once" + "instanceof" + "insteadof" + "interface" + "match" + "namespace" + "new" + "or" + "print" + "require" + "require_once" + "return" + "switch" + "throw" + "trait" + "try" + "use" + "while" + "xor" + (abstract_modifier) + (final_modifier) + (readonly_modifier) + (static_modifier) + (visibility_modifier) +] @keyword + +(function_static_declaration "static" @keyword) + +; Namespace + +(namespace_definition + name: (namespace_name + (name) @module)) + +(namespace_name + (name) @module) + +; Variables + +(relative_scope) @variable.builtin + +(variable_name) @variable + +(method_declaration name: (name) @constructor + (#eq? @constructor "__construct")) + +((name) @constant + (#match? @constant "^_?[A-Z][A-Z\\d_]+$")) +((name) @constant.builtin + (#match? @constant.builtin "^__[A-Z][A-Z\d_]+__$")) +(const_declaration (const_element (name) @constant)) + +; Functions + +(array_creation_expression "array" @function.builtin) +(list_literal "list" @function.builtin) +(exit_statement "exit" @function.builtin "(") + +(method_declaration + name: (name) @function.method) + +(scoped_call_expression + name: (name) @function) + +(member_call_expression + name: (name) @function.method) + +(function_definition + name: (name) @function) + +; Member + +(property_element + (variable_name) @property) + +(member_access_expression + name: (variable_name (name)) @property) +(member_access_expression + name: (name) @property) + +; Basic tokens +[ + (string) + (string_content) + (encapsed_string) + (heredoc) + (heredoc_body) + (nowdoc_body) +] @string +(boolean) @constant.builtin +(null) @constant.builtin +(integer) @number +(float) @number +(comment) @comment + +((name) @variable.builtin + (#eq? @variable.builtin "this")) + +"$" @operator
\ No newline at end of file |
