diff options
Diffstat (limited to 'queries/php/highlights.scm')
| -rw-r--r-- | queries/php/highlights.scm | 191 |
1 files changed, 191 insertions, 0 deletions
diff --git a/queries/php/highlights.scm b/queries/php/highlights.scm new file mode 100644 index 000000000..c01b017a3 --- /dev/null +++ b/queries/php/highlights.scm @@ -0,0 +1,191 @@ +; Types + +[ + (primitive_type) + (cast_type) + ] @type.builtin +(type_name (name) @type) + +; Functions + +(array_creation_expression "array" @function.builtin) +(list_literal "list" @function.builtin) + +(method_declaration + name: (name) @method) + +(function_call_expression + function: (qualified_name (name)) @function) + +(scoped_call_expression + name: (name) @function) + +(member_call_expression + name: (name) @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) + +; Variables + +(relative_scope) @variable.builtin + +((name) @constant + (#match? @constant "^_?[A-Z][A-Z\d_]+$")) + +((name) @constructor + (#match? @constructor "^[A-Z]")) + +((name) @variable.builtin + (#eq? @variable.builtin "this")) + +(variable_name) @variable + +; Basic tokens + +[ + (string) + (heredoc) + ] @string + +(boolean) @boolean +(null) @constant.builtin +(integer) @number +(float) @float +(comment) @comment + +; Keywords + +[ + "$" + "abstract" + "as" + "break" + "class" + "const" + "continue" + "declare" + "default" + "echo" + "enddeclare" + "extends" + "final" + "function" + "global" + "implements" + "insteadof" + "interface" + "namespace" + "new" + "private" + "protected" + "public" + "return" + "static" + "trait" + ] @keyword + +[ + "case" + "else" + "elseif" + "endif" + "endswitch" + "if" + "switch" + ] @conditional + +[ + "do" + "endfor" + "endforeach" + "endwhile" + "for" + "foreach" + "while" + ] @repeat + +[ + "catch" + "finally" + "throw" + "try" + ] @exception + +[ + "include_once" + "include" + "require_once" + "require" + "use" + ] @include + +[ + "," + ";" + "." + ] @punctuation.delimiter + +[ + (php_tag) + "?>" + "(" + ")" + "[" + "]" + "{" + "}" + ] @punctuation.bracket + +[ + "=" + + "-" + "*" + "/" + "+" + "%" + + "~" + "|" + "&" + "<<" + ">>" + + "->" + + "<" + "<=" + ">=" + ">" + "==" + "!=" + "===" + "!==" + + "!" + "&&" + "||" + + "-=" + "+=" + "*=" + "/=" + "%=" + "|=" + "&=" + "--" + "++" +] @operator + +(ERROR) @error |
