From ffb19d5deed8ff4c1191cf3d816fc4b8e29edfd3 Mon Sep 17 00:00:00 2001 From: Dai López <32249161+dpezto@users.noreply.github.com> Date: Fri, 26 Jan 2024 05:30:43 -0600 Subject: feat(gnuplot): added gnuplot parser and queries (#5594) * feat(gnuplot): added gnuplot parser and queries --------- Co-authored-by: Pham Huy Hoang Co-authored-by: Amaan Qureshi --- queries/gnuplot/highlights.scm | 635 +++++++++++++++++++++++++++++++++++++++++ queries/gnuplot/injections.scm | 2 + 2 files changed, 637 insertions(+) create mode 100644 queries/gnuplot/highlights.scm create mode 100644 queries/gnuplot/injections.scm (limited to 'queries/gnuplot') diff --git a/queries/gnuplot/highlights.scm b/queries/gnuplot/highlights.scm new file mode 100644 index 000000000..1ba789118 --- /dev/null +++ b/queries/gnuplot/highlights.scm @@ -0,0 +1,635 @@ +; highlights.scm +(comment) @comment @spell + +(identifier) @variable + +[ + "-" + "+" + "~" + "!" + "$" + "|" + "**" + "*" + "/" + "%" + "==" + "!=" + "<" + "<=" + ">" + ">=" + "<<" + ">>" + "&" + "^" + "&&" + "||" + "=" + "," + "." +] @operator + +[ + "eq" + "ne" +] @keyword.operator + +(ternary_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +"sum" @function.builtin + +[ + "for" + "in" + "do" + "while" +] @keyword.repeat + +[ + (c_break) + (c_cd) + (c_clear) + "evaluate" + "fit" + "help" + "load" + "lower" + "print" + (c_replot) + (c_reread) + "reset" + "splot" + "cmd" + "test" + "undefine" + "vfill" +] @keyword + +(c_pause + "pause" @keyword + "mouse" @variable.member + _? @attribute + ("," + _ @attribute)?) + +(c_plot + "plot" @keyword) + +(c_show + "show" @keyword + "plot"? @attribute) + +(c_stats + "stats" @keyword + ("name" + (_))? @variable.member) + +[ + "via" + "inverse" + "sample" +] @keyword.function + +[ + "if" + "else" +] @keyword.conditional + +(plot_element + "axes"? @variable.member) + +(cntrparam + "auto"? @variable.member) + +(colorbox + "origin"? @attribute) + +(contourfill + "auto"? @variable.member) + +(format + _? @attribute + (_) + _? @attribute) + +(key + "auto"? @variable.member) + +(style ; TODO: complete + [ + "arrow" + "boxplot" + ("data" + [ + (_) + "spiderplot" @attribute + ]) + "fs" + "function" + "line" + "circle" + "rectangle" + "ellipse" + "parallelaxis" + ; (spiderplot) ; TODO: complete + "textbox" + ("watchpoint" + "labels" @attribute + (_)?) + ] @variable.member) + +(terminal + "name" @variable.member) + +; TODO: complete terminals in grammar and then simplify its options here +(t_cairolatex + [ + "eps" + "pdf" + "png" + "standalone" + "input" + "blacktext" + "colortext" + "colourtext" + ("header" + (_)) + "mono" + "color" + "background" + "rounded" + "butt" + ]* + @attribute) + +; (t_canvas) +; (t_cgm) +; (t_context) +; (t_domterm) +; (t_dumb) +; (t_dxf) +; (t_emf) +; (t_epscairo) +; (t_epslatex) +; (t_fig) +; (t_gif) +; (t_hpgl) +; (t_jpeg) +; (t_lua) +; (t_pc15) +; (t_pdfcairo) +; (t_png) +; (t_pngcairo) +; (t_postscript) +; (t_pslatex) +; (t_pstricks) +; (t_qt) +; (t_sixelgd) +; (t_svg [(font_spec)]* @attribute) +; (t_tek4xxx) +; (t_texdraw) +; (t_tikz) +; (t_tkcanvas) +(plot_style + [ + "lines" + "points" + "lp" + "financebars" + "dots" + "impulses" + "labels" + "surface" + "steps" + "fsteps" + "histeps" + "arrows" + "vectors" + "sectors" + "contourfill" + "errorbar" + "errorlines" + "parallelaxes" + "boxes" + "boxerrorbars" + "boxxyerror" + "isosurface" + "boxplot" + "candlesticks" + "circles" + "zerrorfill" + "ellipses" + "filledcurves" + "fillsteps" + "histograms" + "image" + "spiderplot" + "pm3d" + "rgbalpha" + "rgbimage" + "polygons" + "table" + "mask" + ] @attribute) + +[ + "tc" + "fc" + "fs" + "lc" + "ls" + "lw" + "lt" + "pt" + "ps" + "pi" + "pn"