Add @keyword.operator for operators that are English words and add @exception for Java/JS

This commit is contained in:
Stephan Seitz 2020-09-13 15:08:11 +02:00 committed by Stephan Seitz
parent c1313ba7af
commit 7e3c4f8089
10 changed files with 75 additions and 27 deletions

View file

@ -131,9 +131,10 @@ are optional and will not have any effect for now.
@conditional
@repeat
@label for C/Lua-like labels
@operator
@keyword
@keyword.function
@keyword.operator (for operators that are English words, e.g. `and`, `or`)
@operator (for symbolic operators, e.g. `+`, `*`)
@exception
@include keywords for including modules (e.g. import/from in Python)

View file

@ -46,9 +46,10 @@ hlmap["constructor"] = "TSConstructor"
hlmap["conditional"] = "TSConditional"
hlmap["repeat"] = "TSRepeat"
hlmap["label"] = "TSLabel"
hlmap["operator"] = "TSOperator"
hlmap["keyword"] = "TSKeyword"
hlmap["keyword.function"] = "TSKeywordFunction"
hlmap["keyword.operator"] = "TSKeywordOperator"
hlmap["operator"] = "TSOperator"
hlmap["exception"] = "TSException"
hlmap["type"] = "TSType"

View file

@ -48,6 +48,7 @@ highlight default link TSLabel Label
highlight default link TSOperator Operator
highlight default link TSKeyword Keyword
highlight default link TSKeywordFunction Keyword
highlight default link TSKeywordOperator TSOperator
highlight default link TSException Exception
highlight default link TSType Type

View file

@ -101,13 +101,11 @@
"class"
"decltype"
"constexpr"
"delete"
"explicit"
"final"
"friend"
"mutable"
"namespace"
"new"
"override"
"private"
"protected"
@ -119,6 +117,26 @@
(auto)
] @keyword
[
"new"
"delete"
;; these keywords are not supported by the parser
;"eq"
;"not_eq"
;
;"compl"
;"and"
;"or"
;
;"bitand"
;"bitand_eq"
;"bitor"
;"bitor_eq"
;"xor"
;"xor_eq"
] @keyword.operator
"::" @operator
"..." @operator

View file

@ -141,7 +141,6 @@
"abstract"
"assert"
"break"
"catch"
"class"
"continue"
"default"
@ -149,13 +148,11 @@
"exports"
"extends"
"final"
"finally"
"implements"
"instanceof"
"interface"
"module"
"native"
"new"
"open"
"opens"
"package"
@ -168,17 +165,18 @@
"static"
"strictfp"
"synchronized"
"throw"
"throws"
"to"
"transient"
"transitive"
"try"
"uses"
"volatile"
"with"
] @keyword
[
"new"
] @keyword.operator
; Conditionals
[
@ -218,6 +216,16 @@
")"
] @punctuation.bracket
; Exceptions
[
"throw"
"throws"
"finally"
"try"
"catch"
] @exception
; Labels
(labeled_statement
(identifier) @label)

View file

@ -184,30 +184,36 @@
"async"
"await"
"break"
"catch"
"class"
"const"
"debugger"
"delete"
"export"
"extends"
"finally"
"function"
"get"
"in"
"instanceof"
"let"
"new"
"return"
"set"
"static"
"switch"
"target"
"throw"
"try"
"typeof"
"var"
"void"
"with"
"yield"
] @keyword
[
"new"
"delete"
] @keyword.operator
[
"throw"
"try"
"catch"
"finally"
] @exception

View file

@ -51,15 +51,19 @@
] @keyword
;; Operators
[
"not"
"and"
"or"
] @keyword.operator
[
"="
"~="
"=="
"<="
">="
"not"
"and"
"or"
"<"
">"
"+"

View file

@ -157,15 +157,19 @@
"|"
"|="
"~"
"->"
] @operator
; Keywords
[
"and"
"in"
"is"
"not"
"or"
"->"
] @operator
; Keywords
"del"
] @keyword.operator
[
"assert"
@ -173,7 +177,6 @@
"await"
"class"
"def"
"del"
"except"
"exec"
"finally"

View file

@ -5,7 +5,6 @@
[
"alias"
"and"
"begin"
"break"
"class"
@ -13,10 +12,8 @@
"do"
"end"
"ensure"
"in"
"module"
"next"
"or"
"rescue"
"retry"
"return"
@ -24,6 +21,12 @@
"yield"
] @keyword
[
"and"
"or"
"in"
] @keyword.operator
[
"case"
"else"

View file

@ -163,7 +163,10 @@
(escape_sequence) @string.escape
[
"as"
"as"
] @keyword.operator
[
"*"
"'"
"->"