Skip to content

Commit

Permalink
Python syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeniyPeshkov committed May 25, 2019
1 parent 170d2da commit 3bfcbb4
Show file tree
Hide file tree
Showing 7 changed files with 232 additions and 2,279 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Syntax Highlighter Change Log

## Version 0.2.1
### New programming languages:
* Python


## Version 0.2.0
### **Cross-platform support**
### **Cross-platform support.**
**Huge thanks to [@jeff-hykin](https://github.com/jeff-hykin) for providing the right solution.**

There is no need to download .vsxi package for your OS from
Expand All @@ -10,7 +15,7 @@ Cross-platform version in Marketplace fits any OS and architecture.


## Version 0.1.1
### New programming languages
### New programming languages:
* Go
* TypeScript
* JavaScript
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ All these advantages enable accurate and consistent syntax highlighting.
#### Languages:
* C++
* C
* Go
* Python
* TypeScript
* JavaScript
* Go
* More to come upon contribution

## Customization
Expand Down
3 changes: 2 additions & 1 deletion grammars/cpp.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"\"switch\"": "keyword_control",
"\"case\"": "keyword_control",
"\"default\"": "keyword_control",
"\"goto\"": "keyword_control",
"\"goto\"": "keyword_control",

"\"struct\"": "keyword_control",
"\"enum\"": "keyword_control",
"\"union\"": "keyword_control",
Expand Down
2 changes: 1 addition & 1 deletion grammars/langs.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"languages": ["cpp", "c", "go", "typescript", "javascript"]
"languages": ["cpp", "c", "python", "go", "typescript", "javascript"]
}
119 changes: 119 additions & 0 deletions grammars/python.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"simpleTerms": {
"module": "namespace",

"\"global\"": "storage_modifier",
"\"nonlocal\"": "storage_modifier",

"decorator": "function",
"\"print\"": "function",
"\"assert\"": "function",
"\"exec\"": "function",
"\"del\"": "function",

"string": "string",
"escape_sequence": "string",
"interpolation": "string",
"integer" : "number",
"float" : "number",

"none": "keyword_constant",
"true": "keyword_constant",
"false": "keyword_constant",

"comment": "comment",

"\"if\"": "keyword_control",
"\"else\"": "keyword_control",
"\"elif\"": "keyword_control",
"\"while\"": "keyword_control",
"\"for\"": "keyword_control",
"\"return\"": "keyword_control",
"\"break\"": "keyword_control",
"\"continue\"": "keyword_control",
"\"pass\"": "keyword_control",
"\"raise\"": "keyword_control",
"\"yield\"": "keyword_control",
"\"await\"": "keyword_control",
"\"async\"": "keyword_control",
"\"try\"": "keyword_control",
"\"except\"": "keyword_control",
"\"with\"": "keyword_control",
"\"as\"": "keyword_control",
"\"finally\"": "keyword_control",

"\"+\"": "keyword_operator",
"\"-\"": "keyword_operator",
"\"*\"": "keyword_operator",
"\"/\"": "keyword_operator",
"\"%\"": "keyword_operator",
"\"@\"": "keyword_operator",
"\"**\"": "keyword_operator",
"\"//\"": "keyword_operator",
"\"==\"": "keyword_operator",
"\"!=\"": "keyword_operator",
"\"<>\"": "keyword_operator",
"\">\"": "keyword_operator",
"\"<\"": "keyword_operator",
"\">=\"": "keyword_operator",
"\"<=\"": "keyword_operator",
"\"=\"": "keyword_operator",
"\"+=\"": "keyword_operator",
"\"-=\"": "keyword_operator",
"\"*=\"": "keyword_operator",
"\"/=\"": "keyword_operator",
"\"%=\"": "keyword_operator",
"\"@=\"": "keyword_operator",
"\"**=\"": "keyword_operator",
"\"//=\"": "keyword_operator",
"\"&\"": "keyword_operator",
"\"|\"": "keyword_operator",
"\"^\"": "keyword_operator",
"\"~\"": "keyword_operator",
"\"<<\"": "keyword_operator",
"\">>\"": "keyword_operator",

"\"in\"": "keyword_operator",
"\"and\"": "keyword_operator",
"\"or\"": "keyword_operator",
"\"not\"": "keyword_operator",
"\"is\"": "keyword_operator",

"\"import\"": "keyword_directive",
"\"from\"": "keyword_directive",
"\"class\"": "keyword_directive",
"\"def\"": "keyword_directive",
"\"lambda\"": "keyword_directive",

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

},

"complexTerms": ["identifier", "attribute"],

"complexScopes": {
"type > identifier": "type",
"class_definition > identifier": "type",
"class_definition > argument_list > attribute": "type",
"class_definition > argument_list > identifier": "type",
"class_definition > argument_list > keyword_argument > attribute": "type",
"class_definition > argument_list > keyword_argument > identifier": "type",

"identifier": "variable",
"attribute > identifier": "variable",
"keyword_argument > identifier": "variable",
"default_parameter > identifier": "variable",
"parameters > identifier": "variable",
"parameters > list_splat > identifier": "variable",
"parameters > dictionary_splat > identifier": "variable",

"call > identifier": "function",
"call > attribute > identifier[-1]": "function",
"function_definition > identifier": "function",
}
}
Loading

0 comments on commit 3bfcbb4

Please sign in to comment.