-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add php-only language config and queries php-only is required enabling php injections like in blade templates * Add blade templates support
- Loading branch information
Leonardo Eugênio
authored
Mar 17, 2024
1 parent
eead105
commit d99b617
Showing
8 changed files
with
219 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
((directive_start) @start | ||
(directive_end) @end.after | ||
(#set! role block)) | ||
|
||
|
||
((bracket_start) @start | ||
(bracket_end) @end | ||
(#set! role block)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(directive) @tag | ||
(directive_start) @tag | ||
(directive_end) @tag | ||
(comment) @comment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
((text) @injection.content | ||
(#set! injection.combined) | ||
(#set! injection.language php)) | ||
|
||
((php_only) @injection.content | ||
(#set! injection.language php-only)) | ||
((parameter) @injection.content | ||
(#set! injection.language php-only)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
(php_tag) @tag | ||
"?>" @tag | ||
|
||
; Types | ||
|
||
(primitive_type) @type.builtin | ||
(cast_type) @type.builtin | ||
(named_type (name) @type) @type | ||
(named_type (qualified_name) @type) @type | ||
|
||
; Functions | ||
|
||
(array_creation_expression "array" @function.builtin) | ||
(list_literal "list" @function.builtin) | ||
|
||
(method_declaration | ||
name: (name) @function.method) | ||
|
||
(function_call_expression | ||
function: [(qualified_name (name)) (name)] @function) | ||
|
||
(scoped_call_expression | ||
name: (name) @function) | ||
|
||
(member_call_expression | ||
name: (name) @function.method) | ||
|
||
(function_definition | ||
name: (name) @function) | ||
|
||
; Member | ||
|
||
(property_element | ||
(variable_name) @variable.other.member) | ||
|
||
(member_access_expression | ||
name: (variable_name (name)) @variable.other.member) | ||
(member_access_expression | ||
name: (name) @variable.other.member) | ||
|
||
; Variables | ||
|
||
(relative_scope) @variable.builtin | ||
|
||
((name) @constant | ||
(#match? @constant "^_?[A-Z][A-Z\\d_]+$")) | ||
((name) @constant.builtin | ||
(#match? @constant.builtin "^__[A-Z][A-Z\d_]+__$")) | ||
|
||
((name) @constructor | ||
(#match? @constructor "^[A-Z]")) | ||
|
||
((name) @variable.builtin | ||
(#eq? @variable.builtin "this")) | ||
|
||
(variable_name) @variable | ||
|
||
; Basic tokens | ||
[ | ||
(string) | ||
(string_value) | ||
(encapsed_string) | ||
(heredoc) | ||
(heredoc_body) | ||
(nowdoc_body) | ||
] @string | ||
(boolean) @constant.builtin.boolean | ||
(null) @constant.builtin | ||
(integer) @constant.builtin.integer | ||
(float) @constant.builtin.float | ||
(comment) @comment | ||
|
||
"$" @operator | ||
|
||
; Keywords | ||
|
||
"abstract" @keyword | ||
"as" @keyword | ||
"break" @keyword | ||
"case" @keyword | ||
"catch" @keyword | ||
"class" @keyword | ||
"const" @keyword | ||
"continue" @keyword | ||
"declare" @keyword | ||
"default" @keyword | ||
"do" @keyword | ||
"echo" @keyword | ||
"else" @keyword | ||
"elseif" @keyword | ||
"enddeclare" @keyword | ||
"endforeach" @keyword | ||
"endif" @keyword | ||
"endswitch" @keyword | ||
"endwhile" @keyword | ||
"extends" @keyword | ||
"final" @keyword | ||
"finally" @keyword | ||
"for" @keyword | ||
"foreach" @keyword | ||
"function" @keyword | ||
"global" @keyword | ||
"if" @keyword | ||
"implements" @keyword | ||
"include_once" @keyword | ||
"include" @keyword | ||
"insteadof" @keyword | ||
"interface" @keyword | ||
"namespace" @keyword | ||
"new" @keyword | ||
"private" @keyword | ||
"protected" @keyword | ||
"public" @keyword | ||
"require_once" @keyword | ||
"require" @keyword | ||
"return" @keyword | ||
"static" @keyword | ||
"switch" @keyword | ||
"throw" @keyword | ||
"trait" @keyword | ||
"try" @keyword | ||
"use" @keyword | ||
"while" @keyword |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
((comment) @injection.content | ||
(#set! injection.language "comment")) | ||
|
||
(heredoc | ||
(heredoc_body) @injection.content | ||
(heredoc_end) @injection.language) | ||
|
||
(nowdoc | ||
(nowdoc_body) @injection.content | ||
(heredoc_end) @injection.language) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(namespace_definition | ||
name: (namespace_name) @name) @module | ||
|
||
(interface_declaration | ||
name: (name) @name) @definition.interface | ||
|
||
(trait_declaration | ||
name: (name) @name) @definition.interface | ||
|
||
(class_declaration | ||
name: (name) @name) @definition.class | ||
|
||
(class_interface_clause [(name) (qualified_name)] @name) @impl | ||
|
||
(property_declaration | ||
(property_element (variable_name (name) @name))) @definition.field | ||
|
||
(function_definition | ||
name: (name) @name) @definition.function | ||
|
||
(method_declaration | ||
name: (name) @name) @definition.function | ||
|
||
(object_creation_expression | ||
[ | ||
(qualified_name (name) @name) | ||
(variable_name (name) @name) | ||
]) @reference.class | ||
|
||
(function_call_expression | ||
function: [ | ||
(qualified_name (name) @name) | ||
(variable_name (name)) @name | ||
]) @reference.call | ||
|
||
(scoped_call_expression | ||
name: (name) @name) @reference.call | ||
|
||
(member_call_expression | ||
name: (name) @name) @reference.call |