Skip to content

Commit

Permalink
PHP language
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeniyPeshkov committed May 31, 2019
1 parent a128078 commit 0296fb6
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 5 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Syntax Highlighter Change Log

## **Version 0.2.6**
#### New programming languages:
* PHP

#### Fixes:
* TypeScript and Javascript highlighting has been fixed
* In Rust "_" is highlighted as variable
* Internal improvements


## **Version 0.2.6**
#### Changes:
* More consistent names of syntax terms
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* JavaScript
* Go
* Rust
* Php
* More to come...

#### Description
Expand Down
166 changes: 166 additions & 0 deletions grammars/php.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
{
"simpleTerms": {

"variable_name": "variable",

"__construct": "function",
"\"echo\"": "function",
"\"print\"": "function",
"\"unset\"": "function",
"\"isset\"": "function",
"\"eval\"": "function",
"\"array\"": "function",
"\"list\"": "function",
"\"empty\"": "function",

"require_once": "function",
"require": "function",
"include_once": "function",
"include": "function",

"\"callable\"": "modifier",
"\"var\"": "modifier",
"\"trait\"": "modifier",
"\"class\"": "modifier",
"\"interface\"": "modifier",
"\"function\"": "modifier",
"\"type\"": "modifier",

"\"static\"": "modifier",
"\"public\"": "modifier",
"\"private\"": "modifier",
"\"protected\"": "modifier",
"\"global\"": "modifier",
"\"const\"": "modifier",
"\"abstract\"": "modifier",
"\"extends\"": "modifier",
"\"implements\"": "modifier",
"\"final\"": "modifier",

"integer": "number",
"float": "number",
"string": "string",
"regex": "string",

"true": "constant",
"false": "constant",

"comment": "comment",

"\"if\"": "control",
"\"do\"": "control",
"\"else\"": "control",
"\"elseif\"": "control",
"\"endif\"": "control",
"\"while\"": "control",
"\"endwhile\"": "control",
"\"for\"": "control",
"\"endfor\"": "control",
"\"foreach\"": "control",
"\"endforeach\"": "control",
"\"declare\"": "control",
"\"enddeclare\"": "control",
"\"return\"": "control",
"\"break\"": "control",
"\"continue\"": "control",
"\"throw\"": "control",
"\"try\"": "control",
"\"catch\"": "control",
"\"finally\"": "control",
"\"switch\"": "control",
"\"endswitch\"": "control",
"\"case\"": "control",
"\"default\"": "control",
"\"yield\"": "control",
"\"goto\"": "control",
"\"exit\"": "control",
"\"die\"": "control",

"\"new\"": "operator",
"\"clone\"": "operator",
"\"insteadof\"": "operator",
"\"instanceof\"": "operator",

"\"+\"": "operator",
"\"-\"": "operator",
"\"*\"": "operator",
"\"/\"": "operator",
"\"%\"": "operator",
"\"**\"": "operator",
"\"=\"": "operator",
"\"==\"": "operator",
"\"===\"": "operator",
"\"!=\"": "operator",
"\"!==\"": "operator",
"\"<\"": "operator",
"\">\"": "operator",
"\"<>\"": "operator",
"\"<=\"": "operator",
"\"=>\"": "operator",
"\">=\"": "operator",
"\"<=>\"": "operator",
"\"&\"": "operator",
"\"$\"": "operator",
"\"|\"": "operator",
"\"^\"": "operator",
"\"~\"": "operator",
"\"<<\"": "operator",
"\">>\"": "operator",
"\"++\"": "operator",
"\"--\"": "operator",
"\"and\"": "operator",
"\"or\"": "operator",
"\"xor\"": "operator",
"\"!\"": "operator",
"\"&&\"": "operator",
"\"||\"": "operator",
"\".\"": "operator",
"\"?\"": "operator",
"\":\"": "operator",
"\"??\"": "operator",
"\"->\"": "operator",
"\"as\"": "operator",

"\"use\"": "directive",
"\"namespace\"": "directive",

"\"(\"": "punctuation",
"\")\"": "punctuation",
"\"{\"": "punctuation",
"\"}\"": "punctuation",
"\"[\"": "punctuation",
"\"]\"": "punctuation",
"\";\"": "punctuation",
"\",\"": "punctuation",

},

"complexTerms": ["name", "simple_variable"],

"complexScopes": {
"class_declaration > name": "type",
"catch_clause > qualified_name > name": "type",
"class_base_clause > qualified_name > name": "type",
"interface_declaration > name": "type",
"class_interface_clause > qualified_name > name": "type",
"object_creation_expression > qualified_name > name": "type",
"cast_expression > cast_type": "type",
"object_creation_expression > new_variable > simple_variable": "type",

"name": "variable",
"member_access_expression > name": "variable",

"function_definition > name": "function",
"function_call_expression > name": "function",
"function_call_expression > qualified_name": "function",
"method_declaration > name": "function",
"method_declaration > function_definition > name": "function",
"scoped_call_expression > name": "function",
"member_call_expression > name": "function",

"const_element > name": "constant",
"class_constant_access_expression > name": "constant",
"qualified_name > name": "constant",

}
}
11 changes: 10 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
"displayName": "Syntax Highlighter",
"description": "Syntax highlighting based on Tree-sitter",
"homepage": "https://github.com/EvgeniyPeshkov/syntax-highlighter",
"version": "0.2.6",
"version": "0.2.7",
"publisher": "evgeniypeshkov",
"license": "MIT",
"icon": "images/syntax.png",
"galleryBanner": {
"color": "#263238",
"theme": "light"
},
"repository": {
"url": "https://github.com/EvgeniyPeshkov/syntax-highlighter"
},
Expand Down Expand Up @@ -34,7 +38,8 @@
"TypeScript",
"JavaScript",
"Go",
"Rust"
"Rust",
"PHP"
],
"engines": {
"vscode": "^1.15.0"
Expand All @@ -46,7 +51,8 @@
"onLanguage:typescript",
"onLanguage:javascript",
"onLanguage:go",
"onLanguage:rust"
"onLanguage:rust",
"onLanguage:php"
],
"main": "./out/extension.js",
"scripts": {
Expand All @@ -73,7 +79,8 @@
"tree-sitter-typescript": "^0.13.6",
"tree-sitter-javascript": "^0.13.10",
"tree-sitter-go": "^0.13.3",
"tree-sitter-rust": "^0.13.7"
"tree-sitter-rust": "^0.13.7",
"tree-sitter-php": "^0.13.1"
},
"contributes": {
"colors": [
Expand Down

0 comments on commit 0296fb6

Please sign in to comment.