pub const HIGHLIGHTS_QUERY: &str = "(comment) @comment\n\n; Identifiers\n;------------\n\n; Escaped identifiers like \\\"+.\"\n((value_identifier) @constant.macro\n (#match? @constant.macro \"^\\\\.*$\"))\n\n\n((value_identifier) @variable)\n\n[\n (type_identifier)\n (unit_type)\n (list)\n (list_pattern)\n] @type\n\n((type_identifier) @type.builtin\n (#any-of? @type.builtin\n \"int\" \"char\" \"string\" \"float\" \"bool\" \"unit\"))\n\n[\n (variant_identifier)\n (polyvar_identifier)\n] @constructor\n\n(record_type_field (property_identifier) @property)\n(record_field (property_identifier) @property)\n(object (field (property_identifier) @property))\n(object_type (field (property_identifier) @property))\n(module_identifier) @module\n\n(member_expression (property_identifier) @variable.member)\n\n(value_identifier_path\n (module_identifier)\n (value_identifier) @variable)\n\n\n(record_pattern\n (value_identifier_path\n (value_identifier) @variable.member))\n\n(record_pattern\n (value_identifier) @variable)\n\n(labeled_argument\n label: (value_identifier) @variable.parameter)\n\n\n; Parameters\n;----------------\n\n(list_pattern (value_identifier) @variable.parameter)\n(spread_pattern (value_identifier) @variable.parameter)\n\n; String literals\n;----------------\n\n[\n (string)\n (template_string)\n] @string\n\n\n(character) @character\n(escape_sequence) @string.escape\n\n; Other literals\n;---------------\n\n[\n (true)\n (false)\n] @boolean\n\n(number) @number\n(polyvar) @constructor\n(polyvar_string) @constructor\n\n; Functions\n;----------\n\n; parameter(s) in parens\n\n(parameter (value_identifier) @variable.parameter)\n(labeled_parameter (value_identifier) @variable.parameter)\n\n; single parameter with no parens\n(function parameter: (value_identifier) @variable.parameter)\n\n; first-level descructuring (required for nvim-tree-sitter as it only matches direct\n; children and the above patterns do not match destructuring patterns in NeoVim)\n(parameter (tuple_pattern (tuple_item_pattern (value_identifier) @variable.parameter)))\n(parameter (array_pattern (value_identifier) @variable.parameter))\n(parameter (record_pattern (value_identifier) @variable.parameter))\n\n; function identifier in let binding\n(let_binding \n pattern: (value_identifier) @function\n body: (function))\n\n; function calls\n\n(call_expression \n function: (value_identifier_path\n _\n (value_identifier) @function.call))\n\n(call_expression \n function: (value_identifier) @function.call)\n\n; highlight the right-hand side of a pipe operator as a function call\n(pipe_expression\n _\n [(value_identifier_path\n _\n (value_identifier) @function.call)\n (value_identifier) @function.call])\n\n\n; Meta\n;-----\n\n(decorator_identifier) @attribute\n\n(extension_identifier) @keyword\n(\"%\") @keyword\n\n; Misc\n;-----\n\n(polyvar_type_pattern \"#\" @constructor)\n\n[\n \"include\"\n \"open\"\n] @keyword.import\n\n\n[\n \"private\"\n \"mutable\"\n \"rec\"\n] @keyword.modifier\n\n[\n \"type\"\n] @keyword.type\n\n[\n \"and\"\n \"with\"\n \"as\"\n] @keyword.operator\n\n[\n \"export\"\n \"external\"\n \"let\"\n \"module\"\n \"assert\"\n \"await\"\n \"lazy\"\n \"constraint\"\n] @keyword\n\n((\"await\") @keyword.coroutine)\n\n((function \"async\" @keyword.coroutine))\n\n(module_unpack \"unpack\" @keyword)\n\n[\n \"if\"\n \"else\"\n \"switch\"\n \"when\"\n] @keyword.conditional\n\n[\n \"exception\"\n \"try\"\n \"catch\"\n] @keyword.exception\n\n(call_expression\n function: (value_identifier) @keyword.exception\n (#eq? @keyword.exception \"raise\"))\n\n[\n \"for\"\n \"in\"\n \"to\"\n \"downto\"\n \"while\"\n] @keyword.repeat\n\n[\n \".\"\n \",\"\n \"|\"\n \":\"\n] @punctuation.delimiter\n\n[\n \"++\"\n \"+\"\n \"+.\"\n \"-\"\n \"-.\"\n \"*\"\n \"**\"\n \"*.\"\n \"/.\"\n \"<=\"\n \"==\"\n \"===\"\n \"!\"\n \"!=\"\n \"!==\"\n \">=\"\n \"&&\"\n \"||\"\n \"=\"\n \":=\"\n \"->\"\n \"|>\"\n \":>\"\n \"+=\"\n \"=>\"\n (uncurry)\n] @operator\n\n; Explicitly enclose these operators with binary_expression\n; to avoid confusion with JSX tag delimiters\n(binary_expression [\"<\" \">\" \"/\"] @operator)\n\n[\n \"(\"\n \")\"\n \"{\"\n \"}\"\n \"[\"\n \"]\"\n \"<\"\n \">\"\n] @punctuation.bracket\n\n(unit [\"(\" \")\"] @constant.builtin)\n\n(template_substitution\n \"${\" @punctuation.special\n \"}\" @punctuation.special) @none\n\n(polyvar_type\n [\n \"[\"\n \"[>\"\n \"[<\"\n \"]\"\n ] @punctuation.bracket)\n\n[\n \"~\"\n \"?\"\n \"..\"\n \"...\"\n] @punctuation.special\n\n(ternary_expression [\"?\" \":\"] @keyword.conditional.ternary)\n\n; JSX\n;----------\n(jsx_identifier) @tag\n(jsx_element\n open_tag: (jsx_opening_element [\"<\" \">\"] @tag.delimiter))\n(jsx_element\n close_tag: (jsx_closing_element [\"<\" \"/\" \">\"] @tag.delimiter))\n(jsx_self_closing_element [\"/\" \">\" \"<\"] @tag.delimiter)\n(jsx_fragment [\">\" \"<\" \"/\"] @tag.delimiter)\n(jsx_attribute (property_identifier) @tag.attribute)\n\n; Error\n;----------\n\n(ERROR) @error\n";Expand description
The highlights query for rescript.