Skip to main content

HIGHLIGHTS_QUERY

Constant HIGHLIGHTS_QUERY 

Source
pub const HIGHLIGHTS_QUERY: &str = "; highlights.scm\n(comment) @comment @spell\n\"variable\" @variable.parameter\n; built-in named values (palette presets, special color names)\n; TODO: decide and collapse (bgnd & background same)\n; black/viridis constant?\n[\n  \"viridis\"\n  \"black\"\n  \"bgnd\"\n  \"background\"\n] @variable.parameter.builtin\n(identifier) @variable\n[\n  \"[\"\n  \"]\"\n  \"(\"\n  \")\"\n  \"{\"\n  \"}\"\n] @punctuation.bracket\n(operator) @operator\n[\n  \"=\"\n  \",\"\n  \":\"\n] @operator\n(keyword_op) @keyword.operator\n(ternary_op) @keyword.conditional.ternary\n; TODO: collapse\n[\n  \"for\"\n  \"in\"\n  \"do\"\n  \"while\"\n] @keyword.repeat\n; -----------------------------------------------------------------------\n; Commands\n\"cmd\" @keyword\n; TODO: decide and collapse\n[\n  \"newhistogram\"\n  \"newspiderplot\"\n  \"keyentry\"\n] @keyword\n; TODO: decide inverse, sample\n[\n  \"inverse\"\n  \"sample\"\n  \"kw_fn\"\n] @keyword.function\n\"kw_cond\" @keyword.conditional\n; TODO: decide and collapse\n[\n  \"front\"\n  \"back\"\n  \"depthorder\"\n  \"clip\"\n  \"zclip\"\n  \"font\"\n  \"filled\"\n  \"nofilled\"\n  ; coordinate systems (first/second/graph/screen/character/polar) \u{2014} alias \"coord\"\n  \"coord\"\n] @keyword.directive\n; on/off toggle flags ({no}X) \u{2014} alias \"flag\" (@keyword.modifier)\n\"flag\" @keyword.directive\n; enumerated VALUES / modes (alias \"mod\") \u{2014} @constant\n; TODO: decide, constant?\n\"mod\" @constant\n; binary rotate= angle-unit suffixes (rotate=90deg / rotate=0.5 pi);\n; the attached form 0.5pi folds into the number token instead\n[\n  \"degrees\"\n  \"pi\"\n] @constant\n; plot/splot ELEMENT modifiers (alias \"attr\") \u{2014} @property\n; (title/notitle/with/using/index/every/axes/smooth in a plot command;\n;  distinct from set-option names which are @variable.member)\n\"attr\" @property\n; -----------------------------------------------------------------------\n; TODO: decide and collapse\n[\n  ; Terminal output path\n  \"name\"\n  ; Style attribute shorthands (K constants + datafile keywords)\n  \"sa\"\n  \"dt\"\n  \"fc\"\n  \"fs\"\n  \"lc\"\n  \"lt\"\n  \"ps\"\n  \"pt\"\n  \"tc\"\n  \"skip\"\n  \"expand\"\n  \"title\"\n  ; set/show/unset option heads (alias \"opt\") and option-body suboption\n  ; keywords (alias \"arg\") \u{2014} distinct clause families, same visual group\n  \"opt\"\n  \"arg\"\n] @variable.member\n; -----------------------------------------------------------------------\n; Option keywords\n; TODO: decide and collapse\n[\n  ; coordinate systems / axes\n  \"axes_opts\"\n  ; time units (set xdata time / timefmt)\n  ; smooth subtypes still emitted as own token (value-modes csplines/bezier/\u{2026} \u{2192} \"mod\")\n  \"closed\"\n  \"between\"\n  \"above\"\n  \"below\"\n  ; plot / datafile misc\n  \"pixels\"\n  \"whiskerbars\"\n  \"beginning\"\n  \"long\"\n  ; positioning / key\n  \"base\"\n  \"begin\"\n  \"center\"\n  \"end\"\n  ; pm3d / 3d options\n  \"clip1in\"\n  \"clip4in\"\n  \"c2c\"\n  \"retrace\"\n  ; data separators\n  \"whitespace\"\n  \"tab\"\n  \"comma\"\n  ; palette stack\n  \"push\"\n  \"pop\"\n  ; flip binary axes\n  \"flipx\"\n  \"flipy\"\n  \"flipz\"\n  ; binary datafile modifiers\n  \"binary\"\n  \"format\"\n  \"filetype\"\n  \"record\"\n  \"array\"\n  \"origin\"\n  \"dx\"\n  \"dy\"\n  \"level\"\n  \"matrix\"\n  \"columnheaders\"\n  \"rowheaders\"\n  \"nonuniform\"\n  \"sparse\"\n  \"volatile\"\n  \"noautoscale\"\n  \"zsort\"\n  \"mask\"\n  \"sharpen\"\n  \"transpose\"\n  ; endian options (binary)\n  \"endian\"\n  \"little\"\n  \"big\"\n  \"swap\"\n  \"swab\"\n  \"middle\"\n  \"pdp\"\n  ; fit modifiers\n  \"unitweights\"\n  \"errors\"\n  ; command-argument keywords (pause endconditions, exit forms)\n  \"message\"\n  \"status\"\n  \"mouse\"\n  \"keypress\"\n  \"button1\"\n  \"button2\"\n  \"button3\"\n  \"close\"\n  \"any\"\n  ; history command options\n  \"append\"\n  \"quiet\"\n  \"numbers\"\n  \"trim\"\n  \"full\"\n  ; pixmap\n  ; coordinate axis-family prefix (the coord systems first/second/graph/screen/\n  ; character/polar are aliased to (coord) -> @keyword.directive below)\n  \"axis\"\n  ; position direction aliases\n  \"cen\"\n  \"lef\"\n  \"rig\"\n  ; geometry / arrow options\n  \"angle\"\n  \"length\"\n  \"head\"\n  ; offset / scale\n  \"offset\"\n  \"scale\"\n  ; orientation\n  ; angle units\n  ; contour / palette / axis\n  \"range\"\n  \"missing\"\n  \"interpolate\"\n  ; rotation\n  \"rotate\"\n  ; border / extend / range modifiers\n  \"restore\"\n  ; pm3d\n  \"scanorder\"\n  \"position\"\n  ; histogram subtypes\n  ; smooth additions\n  ; key/label placement\n  ; fill pattern\n  \"pattern\"\n  ; 3d / surface\n  \"s\"\n  ; data / fit extras\n  \"variables\"\n  \"datablocks\"\n  \"commentschars\"\n  \"functions\"\n  ; save changes\n  \"changes\"\n  ; misc\n  ; coordinate planes / walls\n  ; colorspec\n  \"rgbcolor\"\n  ; tics\n  ; set size\n  ; set fit\n  \"default\"\n  ; label / style\n  ; set view\n  \"map\"\n  ; set theta direction\n  ; palette model / presets / cubehelix options\n  \"model\"\n  ; pm3d / lighting\n  \"corners2color\"\n  \"primary\"\n  \"specular\"\n  \"spec2\"\n  \"rot_x\"\n  \"rot_z\"\n  \"Phong\"\n  ; dgrid3d subtype (gauss/\u{2026} value-modes \u{2192} \"mod\")\n  ; contour / cntrparam\n  ; tics axes / modifiers\n  ; text / font / encoding\n  ; fill / size style\n  \"empty\"\n  ; layout / spacing / multiplot\n  \"layout\"\n  \"spacing\"\n  \"frac\"\n  ; watch-label / surface options\n  \"point\"\n  ; tics keyword (grid / paxis \u{2014} covers xtics, ytics, ztics contexts)\n  \"tics\"\n  ; histogram fill style\n  ; jitter options\n  ; key command options\n  ; paxis label keyword (key(\"label\",3) with default aka=\"label\")\n  \"label\"\n  ; polar coordinate system and grid option\n  ; polar grid axis ranges\n  ; ellipses style\n  \"units\"\n  ; stats output prefix\n  \"prefix\"\n  ; palette formula option\n  ; grid mode\n  ; datafile option\n  ; textbox / multiplot margins (anonymous \"margins\" string)\n  \"margins\"\n  ; datafile lc/fc palette shorthand\n  \"palette\"\n  ; set fit quiet / results / verbose / brief\n] @variable.member\n; -----------------------------------------------------------------------\n; Presentation / style attributes\n; TODO: decide and collapse\n[\n  \"size\"\n  \"monochrome\"\n  \"color\"\n  \"transparent\"\n  ; palette colour models (set palette model)\n  \"RGB\"\n  \"CMY\"\n  \"HSV\"\n  \"nobackground\"\n  \"separator\"\n  (hull)\n  \"units_opt\"\n  ; fill / line style modes\n  \"solid\"\n  ; page orientation\n  ; terminal options\n  \"animate\"\n  \"input\"\n  ; point type names (ps/tikz terminals)\n  ; key alignment (capitalised)\n  ; layer / style misc\n  \"st_opt\"\n  \"plt_st\"\n] @attribute\n; binary filetype= value (png/jpg/gif/bin parsed as identifier in field)\n(binary_options\n  filetype: (identifier) @attribute)\n; -----------------------------------------------------------------------\n; Macro / datablock identifiers\n(macro) @function.macro\n(datablock) @module\n[\n  (datablock_start)\n  (datablock_end)\n] @label\n; -----------------------------------------------------------------------\n; Functions\n;\n; ORDERING: this file assumes Neovim\'s \"last match wins\" resolution.\n; Under the tree-sitter CLI, Helix, and Zed the FIRST match wins, so these\n; blocks must be reordered there or @function.builtin never fires.\n;\n; Definition head vs call site: `def_func` wraps a definition, but its RHS\n; body call is also a direct `function` child, so the definition rule must\n; anchor to the first child.\n(function\n  name: (identifier) @function.call)\n\n(def_func\n  .\n  (function\n    name: (identifier) @function))\n\n((function\n  name: (identifier) @function.builtin)\n  (#any-of? @function.builtin\n    ; real / complex math\n    \"abs\" \"acos\" \"acosh\" \"airy\" \"arg\" \"asin\" \"asinh\" \"atan\" \"atan2\" \"atanh\"\n    \"besj0\" \"besj1\" \"besjn\" \"besy0\" \"besy1\" \"besyn\" \"besi0\" \"besi1\" \"besin\"\n    \"cbrt\" \"ceil\" \"conj\" \"cos\" \"cosh\" \"exp\" \"floor\" \"imag\" \"int\" \"log\" \"log10\"\n    \"norm\" \"rand\" \"real\" \"round\" \"sgn\" \"sin\" \"sinh\" \"sqrt\" \"tan\" \"tanh\"\n    ; special functions\n    \"EllipticK\" \"EllipticE\" \"EllipticPi\" \"erf\" \"erfc\" \"expint\" \"gamma\" \"ibeta\"\n    \"igamma\" \"inverf\" \"invibeta\" \"invigamma\" \"invnorm\" \"LambertW\" \"lgamma\"\n    \"lnGamma\" \"SynchrotronF\" \"uigamma\" \"voigt\" \"zeta\"\n    ; libcerf\n    \"cerf\" \"cdawson\" \"faddeeva\" \"erfi\" \"FresnelC\" \"FresnelS\" \"VP\" \"VP_fwhm\"\n    ; libamos \u{2014} complex Airy / Bessel\n    \"Ai\" \"Bi\" \"BesselH1\" \"BesselH2\" \"BesselJ\" \"BesselY\" \"BesselI\" \"BesselK\"\n    ; strings\n    \"gprintf\" \"sprintf\" \"strlen\" \"strstrt\" \"substr\" \"split\" \"join\" \"trim\"\n    \"word\" \"words\" \"system\"\n    ; arrays\n    \"index\"\n    ; time\n    \"time\" \"timecolumn\" \"strftime\" \"strptime\"\n    \"tm_hour\" \"tm_mday\" \"tm_min\" \"tm_mon\" \"tm_sec\" \"tm_wday\" \"tm_week\"\n    \"tm_yday\" \"tm_year\" \"weekdate_iso\" \"weekdate_cdc\"\n    ; using-specifier / plotting\n    \"column\" \"columnhead\" \"stringcolumn\" \"strcol\" \"exists\" \"valid\" \"value\"\n    \"hsv2rgb\" \"palette\" \"rgbcolor\" \"voxel\"))\n\n; -----------------------------------------------------------------------\n; Built-in constants\n((identifier) @constant.builtin\n  (#any-of? @constant.builtin \"pi\" \"NaN\" \"Inf\"))\n\n; -----------------------------------------------------------------------\n; Built-in variables (stats output, GPVAL_*, ARG*, vfill loop vars)\n;\n; REGEX DIALECT / GROUP BUDGET \u{2014} read before editing any `#match?` here.\n;\n; Neovim evaluates `#match?` with `vim.regex()`, prepending `\\v` (very magic)\n; whenever the pattern does not already start with `\\v`/`\\m`/`\\M`/`\\V`. Two\n; consequences, both of which have bitten this file:\n;\n;   1. Every bare `(` is a CAPTURING group, and Vim\'s NFA engine allows at\n;      most 9 of them. A tenth aborts the whole query with\n;      `E872: (NFA regexp) Too many \'(\'` \u{2014} highlighting then stops dead at\n;      that predicate and the rest of the buffer renders unhighlighted.\n;      A single combined alternation here once used 14 groups. It is now\n;      split into several patterns; the query engine ORs separate patterns,\n;      so the accepted set is unchanged. Keep each pattern well under 9.\n;\n;   2. Write `(`, `|`, `)`, `?` BARE. Do NOT write `\\(` / `\\|`: under the\n;      auto-prepended `\\v` those are LITERAL characters, so the predicate\n;      would compile cleanly and then silently match nothing.\n;\n; This bare dialect is read identically by Vim\'s very-magic mode and by Rust\n; regex (tree-sitter CLI, Helix, Zed), so it stays portable across engines.\n;\n; The `\\w+_` prefix is deliberate and must not be narrowed to `STATS_`: the\n; prefix is user-selectable (`stats \u{2026} prefix \"FOO\"`, `set fit prefix`).\n\n; stats: moments \u{2014} <prefix>_mean/_stddev/_skewness/_kurtosis (+_err) (+_x/_y)\n((identifier) @variable.builtin\n  (#match? @variable.builtin\n    \"^\\\\w+_(mean|stddev|skewness|kurtosis)(_err)?(_x|_y)?$\"))\n\n; stats: distribution summaries (+_x/_y)\n((identifier) @variable.builtin\n  (#match? @variable.builtin\n    \"^\\\\w+_(min|max|sdd|adev|median|sum(sq)?|(lo|up)_quartile)(_x|_y)?$\"))\n\n; stats: regression, extents, counts, column metadata\n((identifier) @variable.builtin\n  (#match? @variable.builtin\n    \"^\\\\w+_((slope|intercept)(_err)?|size(_x|_y)|column(s|_header)|records|headers|outofrange|invalid|blank|blocks|correlation|sumxy)$\"))\n\n; GPVAL_* / MOUSE_* / FIT_* / ARG*\n((identifier) @variable.builtin\n  (#match? @variable.builtin\n    \"^((GPVAL|MOUSE|FIT)_|ARG)\\\\w+$\"))\n\n; fixed-name built-ins \u{2014} plain string comparison, never reaches a regex engine\n((identifier) @variable.builtin\n  (#any-of? @variable.builtin \"GNUTERM\" \"VoxelDistance\" \"GridDistance\"))\n\n; -----------------------------------------------------------------------\n; Array definitions\n(def_array\n  \"array\" @keyword.function)\n(array\n  (identifier) @function)\n; -----------------------------------------------------------------------\n; Literals\n\"NaN\" @constant.builtin\n(number) @number\n(string_literal) @string\n(escape_sequence) @string.escape\n(format_specifier) @string.special\n\n; watchpoint target (`watch y=50`): the axis/expression name being watched\n(plot_element target: (identifier) @variable.member)\n";
Expand description

The syntax highlighting query for this grammar.