Constant HIGHLIGHTS_QUERY

Source
pub const HIGHLIGHTS_QUERY: &str = "; ----------------------------------------------------------------------------\n; Parameters and variables\n; NOTE: These are at the top, so that they have low priority,\n; and don\'t override destructured parameters\n(variable) @variable\n\n(pattern/wildcard) @variable\n\n(decl/function\n  patterns: (patterns\n    (_) @variable.parameter))\n\n(expression/lambda\n  (_)+ @variable.parameter\n  \"->\")\n\n(decl/function\n  (infix\n    (pattern) @variable.parameter))\n\n; ----------------------------------------------------------------------------\n; Literals and comments\n(integer) @number\n\n(negation) @number\n\n(expression/literal\n  (float)) @number.float\n\n(char) @character\n\n(string) @string\n\n(unit) @string.special.symbol ; unit, as in ()\n\n(comment) @comment\n\n((haddock) @comment.documentation)\n\n; ----------------------------------------------------------------------------\n; Punctuation\n[\n  \"(\"\n  \")\"\n  \"{\"\n  \"}\"\n  \"[\"\n  \"]\"\n] @punctuation.bracket\n\n[\n  \",\"\n  \";\"\n] @punctuation.delimiter\n\n; ----------------------------------------------------------------------------\n; Keywords, operators, includes\n[\n  \"forall\"\n  ; \"\u{2200}\" ; utf-8 is not cross-platform safe\n] @keyword.repeat\n\n(pragma) @keyword.directive\n\n[\n  \"if\"\n  \"then\"\n  \"else\"\n  \"case\"\n  \"of\"\n] @keyword.conditional\n\n[\n  \"import\"\n  \"qualified\"\n  \"module\"\n] @keyword.import\n\n[\n  (operator)\n  (constructor_operator)\n  (all_names)\n  (wildcard)\n  \".\"\n  \"..\"\n  \"=\"\n  \"|\"\n  \"::\"\n  \"=>\"\n  \"->\"\n  \"<-\"\n  \"\\\\\"\n  \"`\"\n  \"@\"\n] @operator\n\n; TODO broken, also huh?\n; ((qualified_module\n;   (module) @constructor)\n;   .\n;   (module))\n\n(module\n  (module_id) @module)\n\n[\n  \"where\"\n  \"let\"\n  \"in\"\n  \"class\"\n  \"instance\"\n  \"pattern\"\n  \"data\"\n  \"newtype\"\n  \"family\"\n  \"type\"\n  \"as\"\n  \"hiding\"\n  \"deriving\"\n  \"via\"\n  \"stock\"\n  \"anyclass\"\n  \"do\"\n  \"mdo\"\n  \"rec\"\n  \"infix\"\n  \"infixl\"\n  \"infixr\"\n] @keyword\n\n; ----------------------------------------------------------------------------\n; Functions and variables\n(decl\n  [\n   name: (variable) @function\n   names: (binding_list (variable) @function)\n  ])\n\n(decl/bind\n  name: (variable) @variable)\n\n; Consider signatures (and accompanying functions)\n; with only one value on the rhs as variables\n(decl/signature\n  name: (variable) @variable\n  type: (type))\n\n((decl/signature\n  name: (variable) @_name\n  type: (type))\n  .\n  (decl\n    name: (variable) @variable)\n    match: (_)\n  (#eq? @_name @variable))\n\n; but consider a type that involves \'IO\' a decl/function\n(decl/signature\n  name: (variable) @function\n  type: (type/apply\n    constructor: (name) @_type)\n  (#eq? @_type \"IO\"))\n\n((decl/signature\n  name: (variable) @_name\n  type: (type/apply\n    constructor: (name) @_type)\n  (#eq? @_type \"IO\"))\n  .\n  (decl\n    name: (variable) @function)\n    match: (_)\n  (#eq? @_name @function))\n\n((decl/signature) @function\n  .\n  (decl/function\n    name: (variable) @function))\n\n(decl/bind\n  name: (variable) @function\n  (match\n    expression: (expression/lambda)))\n\n; view patterns\n(view_pattern\n  [\n    (expression/variable) @function.call\n    (expression/qualified\n      (variable) @function.call)\n  ])\n\n; consider infix functions as operators\n(infix_id\n  [\n    (variable) @operator\n    (qualified\n      (variable) @operator)\n  ])\n\n; decl/function calls with an infix operator\n; e.g. func <$> a <*> b\n(infix\n  [\n    (variable) @function.call\n    (qualified\n      ((module) @module\n        (variable) @function.call))\n  ]\n  .\n  (operator))\n\n; infix operators applied to variables\n((expression/variable) @variable\n  .\n  (operator))\n\n((operator)\n  .\n  [\n    (expression/variable) @variable\n    (expression/qualified\n      (variable) @variable)\n  ])\n\n; decl/function calls with infix operators\n([\n    (expression/variable) @function.call\n    (expression/qualified\n      (variable) @function.call)\n  ]\n  .\n  (operator) @_op\n  (#any-of? @_op \"$\" \"<$>\" \">>=\" \"=<<\"))\n\n; right hand side of infix operator\n((infix\n  [\n    (operator)\n    (infix_id (variable))\n  ] ; infix or `func`\n  .\n  [\n    (variable) @function.call\n    (qualified\n      (variable) @function.call)\n  ])\n  .\n  (operator) @_op\n  (#any-of? @_op \"$\" \"<$>\" \"=<<\"))\n\n; decl/function composition, arrows, monadic composition (lhs)\n(\n  [\n    (expression/variable) @function\n    (expression/qualified\n      (variable) @function)\n  ]\n  .\n  (operator) @_op\n  (#any-of? @_op \".\" \">>>\" \"***\" \">=>\" \"<=<\"))\n\n; right hand side of infix operator\n((infix\n  [\n    (operator)\n    (infix_id (variable))\n  ] ; infix or `func`\n  .\n  [\n    (variable) @function\n    (qualified\n      (variable) @function)\n  ])\n  .\n  (operator) @_op\n  (#any-of? @_op \".\" \">>>\" \"***\" \">=>\" \"<=<\"))\n\n; function composition, arrows, monadic composition (rhs)\n((operator) @_op\n  .\n  [\n    (expression/variable) @function\n    (expression/qualified\n      (variable) @function)\n  ]\n  (#any-of? @_op \".\" \">>>\" \"***\" \">=>\" \"<=<\"))\n\n; function defined in terms of a function composition\n(decl/function\n  name: (variable) @function\n  (match\n    expression: (infix\n      operator: (operator) @_op\n      (#any-of? @_op \".\" \">>>\" \"***\" \">=>\" \"<=<\"))))\n\n(apply\n  [\n    (expression/variable) @function.call\n    (expression/qualified\n      (variable) @function.call)\n  ])\n\n; function compositions, in parentheses, applied\n; lhs\n(apply\n  .\n  (expression/parens\n    (infix\n      [\n        (variable) @function.call\n        (qualified\n          (variable) @function.call)\n      ]\n      .\n      (operator))))\n\n; rhs\n(apply\n  .\n  (expression/parens\n    (infix\n      (operator)\n      .\n      [\n        (variable) @function.call\n        (qualified\n          (variable) @function.call)\n      ])))\n\n; variables being passed to a function call\n(apply\n  (_)\n  .\n  [\n    (expression/variable) @variable\n    (expression/qualified\n      (variable) @variable)\n  ])\n\n; main is always a function\n; (this prevents `main = undefined` from being highlighted as a variable)\n(decl/bind\n  name: (variable) @function\n  (#eq? @function \"main\"))\n\n; scoped function types (func :: a -> b)\n(signature\n  pattern: (pattern/variable) @function\n  type: (quantified_type))\n\n; signatures that have a function type\n; + binds that follow them\n(decl/signature\n  name: (variable) @function\n  type: (quantified_type))\n\n((decl/signature\n  name: (variable) @_name\n  type: (quantified_type))\n  .\n  (decl/bind\n    (variable) @function)\n  (#eq? @function @_name))\n\n; ----------------------------------------------------------------------------\n; Types\n(name) @type\n\n(type/star) @type\n\n(variable) @type\n\n(constructor) @constructor\n\n; True or False\n((constructor) @boolean\n  (#any-of? @boolean \"True\" \"False\"))\n\n; otherwise (= True)\n((variable) @boolean\n  (#eq? @boolean \"otherwise\"))\n\n; ----------------------------------------------------------------------------\n; Quasi-quotes\n(quoter) @function.call\n\n(quasiquote\n  [\n    (quoter) @_name\n    (_\n      (variable) @_name)\n  ]\n  (#eq? @_name \"qq\")\n  (quasiquote_body) @string)\n\n(quasiquote\n  (_\n    (variable) @_name)\n  (#eq? @_name \"qq\")\n  (quasiquote_body) @string)\n\n; namespaced quasi-quoter\n(quasiquote\n  (_\n    (module) @module\n    .\n    (variable) @function.call))\n\n; Highlighting of quasiquote_body for other languages is handled by injections.scm\n; ----------------------------------------------------------------------------\n; Exceptions/error handling\n((variable) @keyword.exception\n  (#any-of? @keyword.exception\n    \"error\" \"undefined\" \"try\" \"tryJust\" \"tryAny\" \"catch\" \"catches\" \"catchJust\" \"handle\" \"handleJust\"\n    \"throw\" \"throwIO\" \"throwTo\" \"throwError\" \"ioError\" \"mask\" \"mask_\" \"uninterruptibleMask\"\n    \"uninterruptibleMask_\" \"bracket\" \"bracket_\" \"bracketOnErrorSource\" \"finally\" \"fail\"\n    \"onException\" \"expectationFailure\"))\n\n; ----------------------------------------------------------------------------\n; Debugging\n((variable) @keyword.debug\n  (#any-of? @keyword.debug\n    \"trace\" \"traceId\" \"traceShow\" \"traceShowId\" \"traceWith\" \"traceShowWith\" \"traceStack\" \"traceIO\"\n    \"traceM\" \"traceShowM\" \"traceEvent\" \"traceEventWith\" \"traceEventIO\" \"flushEventLog\" \"traceMarker\"\n    \"traceMarkerIO\"))\n\n; ----------------------------------------------------------------------------\n; Fields\n\n(field_name\n  (variable) @variable.member)\n\n(import_name\n  (name)\n  .\n  (children\n    (variable) @variable.member))\n\n\n; ----------------------------------------------------------------------------\n; Spell checking\n(comment) @spell\n";
Expand description

The syntax highlighting query for this language.