diff --git a/queries/highlights.scm b/queries/highlights.scm index 80bc0229e..9464589cd 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -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 \ No newline at end of file +;; "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))