Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/rescript/highlights.scm')
| -rw-r--r-- | runtime/queries/rescript/highlights.scm | 194 |
1 files changed, 76 insertions, 118 deletions
diff --git a/runtime/queries/rescript/highlights.scm b/runtime/queries/rescript/highlights.scm index 8decebb4..b9ab8ea6 100644 --- a/runtime/queries/rescript/highlights.scm +++ b/runtime/queries/rescript/highlights.scm @@ -1,69 +1,5 @@ (comment) @comment -[ - "." - "," - "|" -] @punctuation.delimiter - -[ - "++" - "+" - "+." - "-" - "-." - "*" - "**" - "*." - "/." - "<=" - "==" - "===" - "!" - "!=" - "!==" - ">=" - "&&" - "||" - "=" - ":=" - "->" - "|>" - ":>" - "+=" - (uncurry) -] @operator - -; Explicitly enclose these operators with binary_expression -; to avoid confusion with JSX tag delimiters -(binary_expression ["<" ">" "/"] @operator) - -[ - "(" - ")" - "{" - "}" - "[" - "]" -] @punctuation.bracket - -(polyvar_type - [ - "[" - "[>" - "[<" - "]" - ] @punctuation.bracket) - -[ - "~" - "?" - "=>" - ".." - "..." -] @punctuation.special - - ; Identifiers ;------------ @@ -74,22 +10,20 @@ [ (type_identifier) (unit_type) - (list) - (list_pattern) + "list" ] @type [ (variant_identifier) (polyvar_identifier) -] @constructor +] @constant -(record_type_field (property_identifier) @type) -(object_type (field (property_identifier) @type)) -(record_field (property_identifier) @variable.other.member) -(object (field (property_identifier) @variable.other.member)) -(member_expression (property_identifier) @variable.other.member) +(property_identifier) @variable.other.member (module_identifier) @namespace +(jsx_identifier) @tag +(jsx_attribute (property_identifier) @variable.parameter) + ; Parameters ;---------------- @@ -108,8 +42,8 @@ "${" @punctuation.bracket "}" @punctuation.bracket) @embedded -(character) @string.special -(escape_sequence) @string.special +(character) @constant.character +(escape_sequence) @constant.character.escape ; Other literals ;--------------- @@ -126,25 +60,22 @@ ; Functions ;---------- -; parameter(s) in parens [ - (parameter (value_identifier)) + (formal_parameters (value_identifier)) + (positional_parameter (value_identifier)) (labeled_parameter (value_identifier)) ] @variable.parameter -; single parameter with no parens (function parameter: (value_identifier) @variable.parameter) -; first-level descructuring (required for nvim-tree-sitter as it only matches direct -; children and the above patterns do not match destructuring patterns in NeoVim) -(parameter (tuple_pattern (tuple_item_pattern (value_identifier) @variable.parameter))) -(parameter (array_pattern (value_identifier) @variable.parameter)) -(parameter (record_pattern (value_identifier) @variable.parameter)) - ; Meta ;----- -(decorator_identifier) @keyword.directive +[ + "@" + "@@" + (decorator_identifier) +] @label (extension_identifier) @keyword ("%") @keyword @@ -152,13 +83,13 @@ ; Misc ;----- -(subscript_expression index: (string) @attribute) +(subscript_expression index: (string) @variable.other.member) (polyvar_type_pattern "#" @constant) [ ("include") ("open") -] @keyword.control.import +] @keyword [ "as" @@ -171,51 +102,78 @@ "rec" "type" "and" - "assert" - "await" - "with" - "lazy" - "constraint" ] @keyword -((function "async" @keyword.storage)) - -(module_unpack "unpack" @keyword) - [ "if" "else" "switch" - "when" -] @keyword.control.conditional +] @keyword [ "exception" "try" "catch" -] @keyword.control.exception + "raise" +] @keyword + +[ + "." + "," + "|" +] @punctuation.delimiter + +[ + "++" + "+" + "+." + "-" + "-." + "*" + "*." + "/" + "/." + "<" + "<=" + "==" + "===" + "!" + "!=" + "!==" + ">" + ">=" + "&&" + "||" + "=" + ":=" + "->" + "|>" + ":>" + (uncurry) +] @operator + +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket -(call_expression - function: (value_identifier) @keyword.control.exception - (#eq? @keyword.control.exception "raise")) +(polyvar_type + [ + "[" + "[>" + "[<" + "]" + ] @punctuation.bracket) [ - "for" - "in" - "to" - "downto" - "while" -] @keyword.control.conditional + "~" + "?" + "=>" + "..." +] @punctuation (ternary_expression ["?" ":"] @operator) - -; JSX -;---------- -(jsx_identifier) @tag -(jsx_element - open_tag: (jsx_opening_element ["<" ">"] @punctuation.special)) -(jsx_element - close_tag: (jsx_closing_element ["<" "/" ">"] @punctuation.special)) -(jsx_self_closing_element ["/" ">" "<"] @punctuation.special) -(jsx_fragment [">" "<" "/"] @punctuation.special) -(jsx_attribute (property_identifier) @attribute) |