feat(gnuplot!): update parser and queries

Breaking change: full grammar rewrite for 2.0
This commit is contained in:
Christian Clason 2026-07-02 10:12:39 +02:00 committed by Christian Clason
parent 536de0c8ae
commit fc6ad62eab
2 changed files with 28 additions and 200 deletions

View file

@ -752,7 +752,7 @@ return {
},
gnuplot = {
install_info = {
revision = '1d331ed21d4100637272add1ff6ff6bda55828e7',
revision = '20a98295a52caa5f474839838a800d250e8fe1f4',
url = 'https://github.com/dpezto/tree-sitter-gnuplot',
},
maintainers = { '@dpezto' },

View file

@ -25,13 +25,11 @@
; separators and range/assign operators (anonymous tokens)
[
"="
","
":"
] @operator
; assignment = (anonymous; eventual grammar.js refactor will make it (operator))
"=" @operator
(keyword_op) @keyword.operator
(ternary_op) @keyword.conditional.ternary
@ -54,39 +52,36 @@
] @keyword
[
"via"
"inverse"
"sample"
"sum"
"at"
"from"
"to_rto"
"by"
"smooth"
"kw_fn"
] @keyword.function
[
"if"
"else"
] @keyword.conditional
"kw_cond" @keyword.conditional
[
"front"
"back"
"behind"
"depthorder"
"clip"
"noclip"
"opaque"
"font"
"filled"
"nofilled"
"parallel"
"reverse"
"invert"
"extend"
"coord"
] @keyword.directive
; on/off toggle flags ({no}X) — alias "flag"
"flag" @keyword.modifier
; enumerated VALUES / modes (alias "mod")
"mod" @keyword.modifier
; plot/splot ELEMENT modifiers (alias "attr") — @property
; (title/notitle/with/using/index/every/axes/smooth in a plot command;
; distinct from set-option names which are @variable.member)
"attr" @property
; -----------------------------------------------------------------------
; Terminal output path
"name" @variable.member
@ -94,26 +89,18 @@
; -----------------------------------------------------------------------
; Style attribute shorthands (K constants + datafile keywords)
[
"as"
"dl"
"sa"
"dt"
"fc"
"fs"
"lc"
"ls"
"lt"
"lw"
"pi"
"pn"
"ps"
"pt"
"tc"
"skip"
"every"
"index"
"using"
"with"
"expand"
"title"
] @variable.member
; set/show argument keywords (all key("...", n, "arg") aliases)
@ -125,8 +112,6 @@
; coordinate systems / axes
"unit"
"units_opt"
"plane"
"viewaxis"
"axes_opts"
(columnheader)
; time units (set xdata time / timefmt)
@ -138,48 +123,22 @@
"months"
"years"
; smooth subtypes
"discrete"
"incremental"
"unique"
"frequency"
"fnormal"
"cumulative"
"cnormal"
"csplines"
"acsplines"
"mcsplines"
"bezier"
"sbezier"
"path"
"kdensity"
"bandwidth"
"period"
"closed"
"between"
"above"
"below"
"unwrap"
"grid"
; plot / datafile misc
"pixels"
"whiskerbars"
"beginning"
"long"
"nogrid"
; colorspace
"RGB"
"CMY"
"HSV"
; positioning / key
"base"
"begin"
"center"
"end"
"keywidth"
"samplen"
"columns"
; pm3d / 3d options
"ftriangles"
"clip1in"
"clip4in"
"c2c"
@ -204,9 +163,7 @@
"origin"
"dx"
"dy"
"dz"
"width"
"height"
"level"
"matrix"
"nonuniform"
@ -241,80 +198,36 @@
"numbers"
"trim"
"full"
; pixmap
"colormap"
; coordinate system prefixes (position context)
"first"
"second"
"graph"
"screen"
"character"
"axis"
; position direction aliases
"bot"
"cen"
"lef"
"rig"
"top"
; geometry / arrow options
"angle"
"radius"
"length"
"head"
"inout"
"polardistance"
; offset / scale
"offset"
"nooffset"
"scale"
"relative"
"absolute"
; orientation
"vertical"
"horizontal"
; angle units
"degrees"
"radians"
"radial"
; contour / palette / axis
"levels"
"range"
"defined"
"missing"
"interpolate"
"autofreq"
"autojustify"
"overlap"
; rotation
"rotate"
"norotate"
; border / extend / range modifiers
"border"
"noborder"
"noextend"
"writeback"
"restore"
; pm3d scan order
"scanorder"
; histogram subtypes
"clustered"
"rowstacked"
"columnstacked"
"mixed"
"order"
"nokeyseparators"
; smooth additions
"bspline"
"cubicspline"
; key/label placement
"inside"
"outside"
; fill pattern
"pattern"
; 3d / surface
"triangles"
"surface"
"nosurface"
"s"
; data / fit extras
"variables"
@ -323,73 +236,31 @@
"datablocks"
"commentschars"
"functions"
; misc
"both"
"positive"
"negative"
"one"
"two"
"user"
"sorted"
"timedate"
"maxrows"
"maxcolors"
; axes aliases / coordinate planes / walls
"xy"
"wall"
"version"
; colorspec
"rgbcolor"
; tics
"mirror"
; set size
"equal"
"ratio"
; set fit
"covariancevariables"
"errorvariables"
"maxiter"
"default"
; label / style
"boxed"
; set view
"azimuth"
"map"
"projection"
; set theta direction
"theta_dir"
; palette model / presets / cubehelix options
"cubehelix"
"model"
"start"
"gamma"
"cycles"
"saturation"
; pm3d / lighting
"corners2color"
"lighting"
"primary"
"specular"
"spec2"
; smooth / dgrid3d subtypes
"gauss"
"splines"
; contour / cntrparam
"onecolor"
"interval"
"firstlinetype"
; tics axes / modifiers
"ztics"
"cbtics"
"add"
"rangelimited"
; text / font / encoding
"fontscale"
"utf8"
"noboxed"
; fill / size style
"empty"
"square"
; layout / spacing / multiplot
"layout"
"spacing"
@ -398,27 +269,13 @@
"cb"
; filledcurves axis coordinate (x1, x2, y1, y2 etc.)
"coordinate"
; numeric format type
"numeric"
; watch-label / surface options
"point"
"nohidden3d"
; tics keyword (grid / paxis — covers xtics, ytics, ztics contexts)
"tics"
; histogram fill style
"errorbars"
; jitter options
"spread"
"swarm"
; key command options
"box"
"auto"
; paxis label keyword (key("label",3) with default aka="label")
; watchpoint style subcommand (key("labels",-1) covers singular "label" too)
"label"
"labels"
; polar coordinate system and grid option
"polar"
; polar grid axis ranges
"theta"
"r"
@ -426,22 +283,18 @@
"units"
; stats output prefix
"prefix"
; palette formula option
"rgbformulae"
; pm3d z-clip
"z"
; grid mode
"spiderplot"
; binary filetype
"png"
; datafile option
"columnheaders"
; textbox / multiplot margins (anonymous "margins" string)
"margins"
; datafile lc/fc palette shorthand
"palette"
; set fit quiet / results / verbose / brief
"fit_out"
] @variable.member
(columnheader) @variable.member
; -----------------------------------------------------------------------
; Presentation / style attributes
[
@ -449,34 +302,26 @@
"monochrome"
"color"
"transparent"
"enhanced"
; colorspace
"RGB"
"CMY"
"HSV"
"background"
"nobackground"
"separator"
(hull)
"title"
"notitle"
"rectangle"
"circle"
"ellipse"
"polygon"
"units_opt"
; fill / line style modes
"solid"
"dashed"
"rounded"
; page orientation
"landscape"
"portrait"
"eps"
"pdf"
; terminal options
"animate"
"noanimate"
"standalone"
"input"
"colortext"
"blacktext"
"duplex"
; point type names (ps/tikz terminals)
"texpoints"
"normalpoints"
@ -485,27 +330,10 @@
"tinypoints"
"pspoints"
"nopspoints"
; text formatting
"textnormal"
"defaultplex"
; key alignment (capitalised)
"Left"
"Right"
; layer / style misc
"layerdefault"
"st_opt"
"output"
"plt_st"
] @attribute
"plt_st" @attribute
[
(auto)
(autotitle)
(columnheader)
(maxcols)
] @variable.member
; binary filetype= value (png/jpg/gif/bin parsed as identifier in field)
(binary_options
filetype: (identifier) @attribute)