on 3dcf025 help sign in
bat/assets/syntaxes/02_Extra/gnuplot.sublime-syntax
182 lines 8.2 kB history raw
1%YAML 1.2
2---
3# http://www.sublimetext.com/docs/3/syntax.html
4name: gnuplot
5file_extensions:
6 - gp
7 - gpl
8 - gnuplot
9 - gnu
10 - plot
11 - plt
12scope: source.gnuplot
13contexts:
14 main:
15 - include: number
16 - include: string_single
17 - include: string_double
18 - match: '\b(for)\b\s*(\[)'
19 comment: |
20 gnuplot iteration statement.
21 There are two forms:
22 numeric [n = 1:2{:inc}]
23 string based [str in "x y z"]
24 but both can also iterate over lists etc, so this is kept loose.
25 captures:
26 1: keyword.other.iteration.gnuplot
27 2: punctuation.definition.range.begin.gnuplot
28 push:
29 - meta_scope: meta.structure.iteration.gnuplot
30 - match: '\]'
31 captures:
32 0: punctuation.definition.range.end.gnuplot
33 pop: true
34 - include: number
35 - include: operator
36 - include: string_double
37 - include: string_single
38 - match: ":"
39 scope: punctuation.separator.range.gnuplot
40 - match: '\b([a-zA-Z]\w*)\b\s*(=|in)'
41 scope: variable-assignment.range.gnuplot
42 - match: '(?i:[^\s(pi|e)\]])'
43 scope: invalid.illegal.expected-range-separator.gnuplot
44 - match: '\['
45 comment: "gnuplot range statement [a:b]. Lots of things are legal, still more make no sense!"
46 captures:
47 0: punctuation.definition.range.begin.gnuplot
48 push:
49 - meta_scope: meta.structure.range.gnuplot
50 - match: '\]'
51 captures:
52 0: punctuation.definition.range.end.gnuplot
53 pop: true
54 - include: number
55 - include: operator
56 - match: ":"
57 scope: punctuation.separator.range.gnuplot
58 - match: '(?i:[^\s(pi|e)\]])'
59 scope: invalid.illegal.expected-range-separator.gnuplot
60 - match: \\.
61 scope: constant.character.escape.gnuplot
62 - match: '(?<!\$)(#)(?!\{).*$\n?'
63 scope: comment.line.number-sign.gnuplot
64 captures:
65 1: punctuation.definition.comment.gnuplot
66 - match: for
67 comment: introduce in gnuplot 4.3.
68 scope: keyword.other.iteration.gnuplot
69 - match: \b(angles|arrow|autoscale|bars|border|boxwidth|clabel|clip|cntrparam|colorbox|contour|decimalsign|dgrid3d|dummy|encoding|fit|format|grid|hidden3d|historysize|isosamples|key|label|locale|logscale|macros|bmargin|lmargin|rmargin|tmargin|mapping|mouse|multiplot|offsets|origin|output|palette|parametric|pm3d|pointsize|polar|print|rrange|trange|urange|vrange|samples|size|style|surface|tics|ticscale|ticslevel|timestamp|timefmt|title|view|xyplane|x2data|xdata|y2data|ydata|z2data|zdata|x2label|xlabel|y2label|ylabel|z2label|zlabel|x2range|xrange|y2range|yrange|z2range|zrange|mx2tics|mxtics|my2tics|mytics|mz2tics|mztics|nomx2tics|nomxtics|nomy2tics|nomytics|nomz2tics|nomztics|nox2tics|noxtics|noy2tics|noytics|noz2tics|noztics|x2tics|xtics|y2tics|ytics|z2tics|ztics|x2dtics|x2mtics|xdtics|xmtics|y2dtics|y2mtics|ydtics|ymtics|z2dtics|z2mtics|zdtics|zmtics|x2zeroaxis|xzeroaxis|y2zeroaxis|yzeroaxis|z2zeroaxis|zeroaxis|zzeroaxis|zero|)\b
70 scope: keyword.other.setting.gnuplot
71 - match: \b(cd|call|clear|exit|plot|splot|help|load|pause|quit|fit|replot|if|FIT_LIMIT|FIT_MAXITER|FIT_START_LAMBDA|FIT_LAMBDA_FACTOR|FIT_LOG|FIT_SCRIPT|print|pwd|reread|reset|save|show|test|!|functions|var)\b
72 comment: missuse of scopes alert! Just for pretty colours
73 scope: keyword.other.command.gnuplot
74 - match: \b(abs|acos|acosh|arg|asin|asinh|atan|atan2|atanh|besj0|besj1|besy0|besy1|ceil|cos|cosh|erf|erfc|exp|floor|gamma|ibeta|igamma|imag|int|inverf|invnorm|lambertw|lgamma|log|log10|norm|rand|real|sgn|sin|sinh|sqrt|tan|tanh)\b
75 scope: support.function.gnuplot
76 - match: \b(gprintf|sprintf|strlen|strstrt|substr|system|word|words)\b
77 scope: support.function.string.gnuplot
78 - match: \b(on|off|default|inside|outside|lmargin|rmargin|tmargin|bmargin|at|left|right|center|top|bottom|center|vertical|horizontal|Left|Right|noreverse|noinvert|samplen|spacing|width|height|noautotitle|columnheader|title|noenhanced|nobox|linestyle|ls|linetype|lt|linewidth|lw)\b
79 scope: constant.other.type.gnuplot
80 - match: \b(aed512|aed767|aifm|aqua|bitgraph|cgm|corel|dumb|dxf|eepic|emf|emtex|epslatex|epson_180dpi|epson_60dpi|epson_lx800|fig|gif|gpic|hp2623A|hp2648|hp500c|hpdj|hpgl|hpljii|hppj|imagen|jpeg|kc_tek40xx|km_tek40xx|latex|mf|mif|mp|nec_cp6|okidata|pbm|pcl5|pdf|png|postscript|pslatex|pstex|pstricks|qms|regis|selanar|starc|svg|tandy_60dpi|tek40xx|tek410x|texdraw|tgif|tkcanvas|tpic|unknown|vttek)\b
81 scope: constant.other.terminal.gnuplot
82 - match: \b(u(sing)?|t(it(le)?)?|notit(le)?|w(i(th)?)?|steps|fs(teps)?|notitle|l(i(nes)?)?|linespoints|via)\b
83 scope: keyword.modifier.gnuplot
84 - match: |-
85 (?x:
86 \b # Start with a word boundary
87 (?=\b[\w$]*(\(|.*=)) # Look-ahead for a bracket or equals
88 (?![^(]*\)) # negative look ahead for a closing bracket without an opening one. This stops a from matching in f(a)
89 ( # Group variable name
90 [A-Za-z] # A letter
91 [\w$]* # Any word chars or $
92 ) # That is it for the name.
93 )
94 comment: user defined function / variable
95 scope: variable.other.gnuplot
96 - match: \b(if)\b
97 scope: keyword.control.gnuplot
98 - match: \b(show)\b
99 captures:
100 0: keyword.other.command.gnuplot
101 push:
102 - meta_scope: keyword.line.show.gnuplot
103 - meta_content_scope: keyword.line.show.gnuplot
104 - match: (?!\#)($\n?)
105 pop: true
106 - include: main
107 - match: \b(set)\b\s*\b(terminal|term)\b
108 captures:
109 1: keyword.other.command.gnuplot
110 2: keyword.other.setting.gnuplot
111 push:
112 - meta_scope: keyword.line.set.terminal.gnuplot
113 - match: (?!\#)($\n?)
114 pop: true
115 - include: main
116 - match: \b(set)\b\s*\b(key)\b
117 captures:
118 1: keyword.other.command.gnuplot
119 2: keyword.other.setting.gnuplot
120 push:
121 - meta_scope: keyword.line.set.key.gnuplot
122 - match: (?!\#)($\n?)
123 pop: true
124 - include: main
125 - match: \b(set|unset)\b\s*(?!\b(terminal|key|for)\b)
126 captures:
127 1: keyword.other.command.gnuplot
128 2: keyword.other.setting.gnuplot
129 push:
130 - meta_scope: keyword.line.set.gnuplot
131 - meta_content_scope: keyword.line.set.gnuplot
132 - match: (?!\#)($\n?)
133 pop: true
134 - include: main
135 number:
136 - match: |-
137 (?x: # turn on extended mode
138 -? # an optional minus
139 (?:
140 0 # a zero
141 | # ...or...
142 [1-9] # a 1-9 character
143 \d* # followed by zero or more digits
144 )
145 (?:
146 \. # a period
147 \d+ # followed by one or more digits
148 (?:
149 [eE] # an e character
150 [+-]? # followed by an option +/-
151 \d+ # followed by one or more digits
152 )? # make exponent optional
153 )? # make decimal portion optional
154 )
155 comment: borrowed from textmate book
156 scope: constant.numeric.gnuplot
157 operator:
158 - match: \s*(==|~=|>|>=|<|<=|&|&&|:|\||\|\||\+|-|\*|\.\*|/|\./|\\|\.\\|\^|\.\^)\s*
159 comment: Operator symbols
160 scope: keyword.operator.symbols.matlab
161 string_double:
162 - match: '"'
163 captures:
164 0: punctuation.definition.string.begin.gnuplot
165 push:
166 - meta_scope: string.quoted.double.gnuplot
167 - match: '"'
168 captures:
169 0: punctuation.definition.string.end.gnuplot
170 pop: true
171 - match: '\\[\$`"\\\n]'
172 scope: constant.character.escape.gnuplot
173 string_single:
174 - match: "'"
175 captures:
176 0: punctuation.definition.string.begin.gnuplot
177 push:
178 - meta_scope: string.quoted.single.gnuplot
179 - match: "'"
180 captures:
181 0: punctuation.definition.string.end.gnuplot
182 pop: true