-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from mattmassicotte/feature/php
PHP support
- Loading branch information
Showing
24 changed files
with
246 additions
and
17 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
115 changes: 115 additions & 0 deletions
115
Sources/tree_sitter_language_resources/LanguageResources/php/highlights.scm
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,115 @@ | ||
(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)) @function) | ||
|
||
(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) | ||
|
||
; 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) @string | ||
(heredoc) @string | ||
(boolean) @constant.builtin | ||
(null) @constant.builtin | ||
(integer) @number | ||
(float) @number | ||
(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 | ||
"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 |
3 changes: 3 additions & 0 deletions
3
Sources/tree_sitter_language_resources/LanguageResources/php/injections.scm
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,3 @@ | ||
((text) @injection.content | ||
(#set! injection.language "html") | ||
(#set! injection.combined)) |
26 changes: 26 additions & 0 deletions
26
Sources/tree_sitter_language_resources/LanguageResources/php/tags.scm
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,26 @@ | ||
(class_declaration | ||
name: (name) @name) @definition.class | ||
|
||
(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 |
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
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 |
---|---|---|
|
@@ -13,4 +13,4 @@ extern TSLanguage *tree_sitter_go(); | |
} | ||
#endif | ||
|
||
#endif // TREE_SITTER_GO_H_ | ||
#endif // TREE_SITTER_GO_H_ |
16 changes: 16 additions & 0 deletions
16
tree_sitter.xcframework/ios-arm64/tree_sitter.framework/Headers/php.h
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,16 @@ | ||
#ifndef TREE_SITTER_PHP_H_ | ||
#define TREE_SITTER_PHP_H_ | ||
|
||
#include <tree_sitter/parser.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
extern TSLanguage *tree_sitter_php(); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // TREE_SITTER_PHP_H_ |
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
Binary file modified
BIN
+1.04 MB
(110%)
tree_sitter.xcframework/ios-arm64/tree_sitter.framework/tree_sitter
Binary file not shown.
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 |
---|---|---|
|
@@ -13,4 +13,4 @@ extern TSLanguage *tree_sitter_go(); | |
} | ||
#endif | ||
|
||
#endif // TREE_SITTER_GO_H_ | ||
#endif // TREE_SITTER_GO_H_ |
16 changes: 16 additions & 0 deletions
16
tree_sitter.xcframework/ios-arm64_x86_64-maccatalyst/tree_sitter.framework/Headers/php.h
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,16 @@ | ||
#ifndef TREE_SITTER_PHP_H_ | ||
#define TREE_SITTER_PHP_H_ | ||
|
||
#include <tree_sitter/parser.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
extern TSLanguage *tree_sitter_php(); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // TREE_SITTER_PHP_H_ |
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
Binary file modified
BIN
+2.09 MB
(110%)
tree_sitter.xcframework/ios-arm64_x86_64-maccatalyst/tree_sitter.framework/tree_sitter
Binary file not shown.
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 |
---|---|---|
|
@@ -13,4 +13,4 @@ extern TSLanguage *tree_sitter_go(); | |
} | ||
#endif | ||
|
||
#endif // TREE_SITTER_GO_H_ | ||
#endif // TREE_SITTER_GO_H_ |
16 changes: 16 additions & 0 deletions
16
tree_sitter.xcframework/ios-arm64_x86_64-simulator/tree_sitter.framework/Headers/php.h
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,16 @@ | ||
#ifndef TREE_SITTER_PHP_H_ | ||
#define TREE_SITTER_PHP_H_ | ||
|
||
#include <tree_sitter/parser.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
extern TSLanguage *tree_sitter_php(); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // TREE_SITTER_PHP_H_ |
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
Binary file modified
BIN
+1.24 MB
(110%)
tree_sitter.xcframework/ios-arm64_x86_64-simulator/tree_sitter.framework/tree_sitter
Binary file not shown.
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 |
---|---|---|
|
@@ -13,4 +13,4 @@ extern TSLanguage *tree_sitter_go(); | |
} | ||
#endif | ||
|
||
#endif // TREE_SITTER_GO_H_ | ||
#endif // TREE_SITTER_GO_H_ |
Oops, something went wrong.