Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/cue/highlights.scm')
| -rw-r--r-- | runtime/queries/cue/highlights.scm | 173 |
1 files changed, 64 insertions, 109 deletions
diff --git a/runtime/queries/cue/highlights.scm b/runtime/queries/cue/highlights.scm index 4168036b..aef016e8 100644 --- a/runtime/queries/cue/highlights.scm +++ b/runtime/queries/cue/highlights.scm @@ -1,46 +1,12 @@ -; Includes -[ - "package" - "import" -] @keyword.control.import +(package_clause "package" @keyword.control.import) -; Namespaces -(package_identifier) @namespace +(package_identifier) @variable -(import_spec - [ - "." - "_" - ] @punctuation.special) +(import_declaration "import" @keyword.control.import) [ - (attr_path) - (package_path) -] @string.special.url ; In attributes - -; Attributes -(attribute) @attribute - -; Conditionals -"if" @keyword.control.conditional - -; Repeats -"for" @keyword.control.repeat - -(for_clause - "_" @punctuation.special) - -; Keywords -"let" @keyword - -"in" @keyword.operator - -; Operators -[ - "+" - "-" + "!" "*" - "/" "|" "&" "||" @@ -53,103 +19,92 @@ ">=" "=~" "!~" - "!" - "=" + "+" + "-" + "*" + "/" ] @operator -; Fields & Properties -(field - (label - (identifier) @variable.other.member)) +(unary_expression "*" @operator.default) + +(unary_expression "=~" @operator.regexp) + +(unary_expression "!~" @operator.regexp) + +(binary_expression _ "&" @operator.unify _) + +(binary_expression _ "|" @operator.disjunct _) -(selector_expression - (_) - (identifier) @variable.other.member) +(builtin) @function.builtin -; Functions -(call_expression - function: (identifier) @function) +(qualified_identifier) @function.builtin -(call_expression - function: (selector_expression - (_) - (identifier) @function)) +(let_clause "let" @keyword.storage.type) -(call_expression - function: (builtin_function) @function) +(for_clause "for" @keyword.control.repeat) +(for_clause "in" @keyword.control.repeat) -(builtin_function) @function.builtin +(guard_clause "if" @keyword.control.conditional) -; Variables -(identifier) @variable +(comment) @comment -; Types -(primitive_type) @type.builtin +[ + (string_type) + (simple_string_lit) + (multiline_string_lit) + (bytes_type) + (simple_bytes_lit) + (multiline_bytes_lit) +] @string -((identifier) @type - (#match? @type "^_?#")) +[ + (number_type) + (int_lit) + (int_type) + (uint_type) +] @constant.numeric.integer [ - (slice_type) - (pointer_type) -] @type ; In attributes + (float_lit) + (float_type) +] @constant.numeric.float + +[ + (bool_type) + (true) + (false) +] @constant.builtin.boolean + +(null) @constant.builtin + +(ellipsis) @punctuation.bracket -; Punctuation [ "," ":" ] @punctuation.delimiter [ - "{" - "}" - "[" - "]" "(" ")" - "<" - ">" + "[" + "]" + "{" + "}" ] @punctuation.bracket -[ - (ellipsis) - "?" -] @punctuation.special - -; Literals -(string) @string +(interpolation "\\(" @punctuation.bracket (_) ")" @punctuation.bracket) @variable.other.member -[ - (escape_char) - (escape_unicode) -] @constant.character.escape +(field (label (identifier) @variable.other.member)) -(number) @constant.numeric +( + (identifier) @keyword.storage.type + (#match? @keyword.storage.type "^#") +) -(float) @constant.numeric.float +(field (label alias: (identifier) @label)) -(si_unit - (float) - (_) @string.special.symbol) +(let_clause left: (identifier) @label) -(boolean) @constant.builtin.boolean -[ - (null) - (top) - (bottom) -] @constant.builtin - -; Interpolations -(interpolation - "\\(" @punctuation.special - (_) - ")" @punctuation.special) - -(interpolation - "\\(" - (identifier) @variable - ")") - -; Comments -(comment) @comment +(attribute (identifier) @tag) |