Highlighting improvements.

pull/185/head
Ben Sobel 2020-07-25 10:05:28 +07:00
parent c0774755b8
commit fc8f57142f
1 changed files with 156 additions and 38 deletions

@ -11,7 +11,47 @@
(marker_annotation
name: (identifier) @attribute)
"@" @operator
; Operators and Tokens
(template_substitution
"${" @punctuation.special
"}" @punctuation.special) @embedded
[
";"
"."
","
] @punctuation.delimiter
[
"--"
"-"
"-="
"&&"
"+"
"++"
"+="
"<"
"<<"
"="
"=="
"==="
"=>"
">"
">>"
"||"
"@"
] @operator
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
; Types
@ -42,15 +82,23 @@
((identifier) @constant
(#match? @constant "^_*[A-Z][A-Z\d_]+"))
(identifier) @variable
(this) @variable.builtin
; Literals
(hex_integer_literal) @number
(decimal_integer_literal) @number
(octal_integer_literal) @number
(decimal_floating_point_literal) @number
(hex_floating_point_literal) @number
[
(hex_integer_literal)
(decimal_integer_literal)
(octal_integer_literal)
(decimal_floating_point_literal)
(hex_floating_point_literal)
] @number
(symbol_literal) @string.special.symbol
(string_literal) @string
(true) @constant.builtin
(false) @constant.builtin
@ -60,35 +108,105 @@
; Keywords
"abstract" @keyword
"assert" @keyword
"break" @keyword
"case" @keyword
"catch" @keyword
"on" @keyword
"class" @keyword
"continue" @keyword
"default" @keyword
"do" @keyword
"else" @keyword
"enum" @keyword
"export" @keyword
"extends" @keyword
"final" @keyword
"finally" @keyword
"for" @keyword
"if" @keyword
"implements" @keyword
"import" @keyword
"is" @keyword
"as" @keyword
"mixin" @keyword
"external" @keyword
"new" @keyword
"return" @keyword
"static" @keyword
"switch" @keyword
"throw" @keyword
; "rethrow" @keyword
"try" @keyword
"while" @keyword
;; "abstract" @keyword
;; "assert" @keyword
;; "break" @keyword
;; "case" @keyword
;; "catch" @keyword
;; "on" @keyword
;; "class" @keyword
;; "continue" @keyword
;; "default" @keyword
;; "do" @keyword
;; "else" @keyword
;; "enum" @keyword
;; "export" @keyword
;; "extends" @keyword
;; "final" @keyword
;; "finally" @keyword
;; "for" @keyword
;; "if" @keyword
;; "implements" @keyword
;; "import" @keyword
;; "is" @keyword
;; "as" @keyword
;; "mixin" @keyword
;; "external" @keyword
;; "new" @keyword
;; "return" @keyword
;; "static" @keyword
;; "switch" @keyword
;; "throw" @keyword
;; ; "rethrow" @keyword
;; "try" @keyword
;; "while" @keyword
; Reserved words (cannot be used as identifiers)
[
"assert"
"break"
"case"
"catch"
"class"
"const"
"continue"
"default"
"do"
"else"
"enum"
"extends"
; "false"
"final"
"finally"
"for"
"if"
"in"
"is"
"new"
; "null"
"rethrow"
"return"
"super"
"switch"
; "this"
"throw"
; "true"
"try"
"var"
"void"
"while"
"with"
] @keyword
; Built in identifiers:
;; alone:
[
"abstract"
"as"
"covariant"
"deferred"
"dynamic"
"export"
"external"
"factory"
"Function"
"get"
"implements"
"import"
"interface"
"library"
"operator"
"mixin"
"part"
"set"
"static"
"typedef"
] @keyword
;; when used as an identifier:
((identifier) @variable.builtin
(#match? @variable.builtin "^(abstract|as|covariant|deferred|dynamic|export|external|factory|Function|get|implements|import|interface|library|operator|mixin|part|set|static|typedef)$")
(#is-not? local))