1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <!-- |
---|
3 | Authors: Philip Withnall |
---|
4 | Copyright © 2018 Philip Withnall <philip@tecnocode.co.uk> |
---|
5 | |
---|
6 | GtkSourceView is free software; you can redistribute it and/or |
---|
7 | modify it under the terms of the GNU Lesser General Public |
---|
8 | License as published by the Free Software Foundation; either |
---|
9 | version 2.1 of the License, or (at your option) any later version. |
---|
10 | |
---|
11 | GtkSourceView is distributed in the hope that it will be useful, |
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
14 | Lesser General Public License for more details. |
---|
15 | |
---|
16 | You should have received a copy of the GNU Lesser General Public License |
---|
17 | along with this library; if not, see <https://www.gnu.org/licenses/>. |
---|
18 | |
---|
19 | Reference: https://survex.com/docs/manual/datafile.htm |
---|
20 | --> |
---|
21 | <language id="survex" name="Survex" version="2.0" _section="Source"> |
---|
22 | <metadata> |
---|
23 | <property name="mimetypes">text/x-survex</property> |
---|
24 | <property name="globs">*.svx</property> |
---|
25 | <property name="line-comment-start">;</property> |
---|
26 | </metadata> |
---|
27 | |
---|
28 | <styles> |
---|
29 | <style id="comment" name="Comment" map-to="def:comment"/> |
---|
30 | <style id="error" name="Error" map-to="def:error"/> |
---|
31 | <style id="literal" name="Literal" map-to="def:string"/> |
---|
32 | <style id="command" name="Command" map-to="def:statement"/> |
---|
33 | <style id="parameter" name="Parameter" map-to="def:type"/> |
---|
34 | <style id="identifier" name="Identifier" map-to="def:identifier"/> |
---|
35 | <style id="number" name="Number" map-to="def:decimal"/> |
---|
36 | </styles> |
---|
37 | |
---|
38 | <default-regex-options case-sensitive="false"/> |
---|
39 | |
---|
40 | <definitions> |
---|
41 | |
---|
42 | <define-regex id="survey-name">[a-zA-Z0-9_\-\.]+</define-regex> |
---|
43 | <define-regex id="station-name">[a-zA-Z0-9_\-\.]+</define-regex> |
---|
44 | <define-regex id="date">[0-9]+(?:\.[0-9]+(?:\.[0-9+])?)?(?:\-[0-9]+(?:\.[0-9]+(?:\.[0-9+])?)?)?</define-regex> |
---|
45 | <define-regex id="number" extended="true"> |
---|
46 | [-+]?[0-9]+\.[0-9]*| |
---|
47 | [-+]?[0-9]+| |
---|
48 | [-+]?[0-9]*\.[0-9]+ |
---|
49 | </define-regex> |
---|
50 | <define-regex id="string" extended="true"> |
---|
51 | (?:[^\s"]+)| |
---|
52 | (?:"[^"]*") |
---|
53 | </define-regex> |
---|
54 | |
---|
55 | <define-regex id="data-style" extended="true"> |
---|
56 | default| |
---|
57 | normal| |
---|
58 | diving| |
---|
59 | cartesian| |
---|
60 | topofil| |
---|
61 | cylpolar| |
---|
62 | nosurvey| |
---|
63 | passage |
---|
64 | </define-regex> |
---|
65 | |
---|
66 | <define-regex id="data-instruments" extended="true"> |
---|
67 | from| |
---|
68 | to| |
---|
69 | tape| |
---|
70 | compass| |
---|
71 | clino| |
---|
72 | backcompass| |
---|
73 | backclino| |
---|
74 | station| |
---|
75 | direction| |
---|
76 | fromdepth| |
---|
77 | todepth| |
---|
78 | depthchange| |
---|
79 | northing| |
---|
80 | easting| |
---|
81 | altitude| |
---|
82 | newline| |
---|
83 | left| |
---|
84 | right| |
---|
85 | up| |
---|
86 | down| |
---|
87 | ignoreall| |
---|
88 | ignore| |
---|
89 | length| |
---|
90 | bearing| |
---|
91 | gradient| |
---|
92 | count |
---|
93 | </define-regex> |
---|
94 | |
---|
95 | <define-regex id="coordinate-system" extended="true"> |
---|
96 | custom| |
---|
97 | epsg| |
---|
98 | esri| |
---|
99 | eur79z30| |
---|
100 | ijtsk| |
---|
101 | ijtsk03| |
---|
102 | jtsk| |
---|
103 | jtsk03| |
---|
104 | long-lat| |
---|
105 | osgb| |
---|
106 | s-merc| |
---|
107 | utm |
---|
108 | </define-regex> |
---|
109 | |
---|
110 | <!-- FIXME: Should this be the same list as data-instruments? --> |
---|
111 | <define-regex id="quantity" extended="true"> |
---|
112 | tape| |
---|
113 | length| |
---|
114 | backtape| |
---|
115 | backlength| |
---|
116 | compass| |
---|
117 | bearing| |
---|
118 | backcompass| |
---|
119 | backbearing| |
---|
120 | clino| |
---|
121 | gradient| |
---|
122 | backclino| |
---|
123 | backgradient| |
---|
124 | counter| |
---|
125 | count| |
---|
126 | depth| |
---|
127 | declination| |
---|
128 | dx| |
---|
129 | easting| |
---|
130 | dy| |
---|
131 | northing| |
---|
132 | dz| |
---|
133 | altitude| |
---|
134 | left| |
---|
135 | right| |
---|
136 | up| |
---|
137 | ceiling| |
---|
138 | down| |
---|
139 | floor| |
---|
140 | level| |
---|
141 | plumb| |
---|
142 | position |
---|
143 | </define-regex> |
---|
144 | |
---|
145 | <!-- FIXME: Should this be the same list as data-instruments? --> |
---|
146 | <define-regex id="calibrate-quantity" extended="true"> |
---|
147 | tape| |
---|
148 | compass| |
---|
149 | clino| |
---|
150 | counter| |
---|
151 | depth| |
---|
152 | declination| |
---|
153 | x| |
---|
154 | y| |
---|
155 | z |
---|
156 | </define-regex> |
---|
157 | |
---|
158 | <define-regex id="unit" extended="true"> |
---|
159 | default| |
---|
160 | yards| |
---|
161 | feet| |
---|
162 | metric| |
---|
163 | meters| |
---|
164 | metres| |
---|
165 | degs| |
---|
166 | degrees| |
---|
167 | grads| |
---|
168 | mils| |
---|
169 | minutes| |
---|
170 | percentage| |
---|
171 | percent |
---|
172 | </define-regex> |
---|
173 | |
---|
174 | <define-regex id="set-item" extended="true"> |
---|
175 | blank| |
---|
176 | comment| |
---|
177 | decimal| |
---|
178 | eol| |
---|
179 | keyword| |
---|
180 | minus| |
---|
181 | names| |
---|
182 | omit| |
---|
183 | plus| |
---|
184 | root| |
---|
185 | separator |
---|
186 | </define-regex> |
---|
187 | |
---|
188 | <context id="string" style-ref="literal" end-at-line-end="true"> |
---|
189 | <start>"</start> |
---|
190 | <end>"</end> |
---|
191 | </context> |
---|
192 | |
---|
193 | <context id="numeric" style-ref="number"> |
---|
194 | <match>(\%{number})</match> |
---|
195 | </context> |
---|
196 | |
---|
197 | <context id="station-name" style-ref="number"> |
---|
198 | <match>(\%{station-name})</match> |
---|
199 | </context> |
---|
200 | |
---|
201 | <context id="line-comment" style-ref="comment" end-at-line-end="true"> |
---|
202 | <start>;</start> |
---|
203 | <include> |
---|
204 | <context ref="def:in-line-comment"/> |
---|
205 | </include> |
---|
206 | </context> |
---|
207 | |
---|
208 | <context id="alias-command"> |
---|
209 | <match>^\s*(\*alias)\s+(station)\s+(\%{station-name})(?:\s+(\%{station-name}))?</match> |
---|
210 | <include> |
---|
211 | <context sub-pattern="1" style-ref="command"/> |
---|
212 | <context sub-pattern="2" style-ref="parameter"/> |
---|
213 | <context sub-pattern="3" style-ref="identifier"/> |
---|
214 | </include> |
---|
215 | </context> |
---|
216 | |
---|
217 | <context id="begin-command"> |
---|
218 | <match>^\s*(\*begin)(?:\s+(\%{survey-name}))?</match> |
---|
219 | <include> |
---|
220 | <context sub-pattern="1" style-ref="command"/> |
---|
221 | <context sub-pattern="2" style-ref="identifier"/> |
---|
222 | </include> |
---|
223 | </context> |
---|
224 | |
---|
225 | <context id="calibrate-command"> |
---|
226 | <match>^\s*(\*calibrate)(?:(?:((?:\s+(?:\%{calibrate-quantity}))+)\s+(\%{number})(?:\s+(\%{unit}))?(?:\s+(\%{number}))?)|\s+(default))</match> |
---|
227 | <include> |
---|
228 | <context sub-pattern="1" style-ref="command"/> |
---|
229 | <context sub-pattern="2" style-ref="parameter"/> |
---|
230 | <context sub-pattern="3" style-ref="number"/> |
---|
231 | <context sub-pattern="4" style-ref="parameter"/> |
---|
232 | <context sub-pattern="5" style-ref="number"/> |
---|
233 | <context sub-pattern="6" style-ref="parameter"/> |
---|
234 | </include> |
---|
235 | </context> |
---|
236 | |
---|
237 | <context id="case-command"> |
---|
238 | <match>^\s*(\*case)\s+(preserve|toupper|tolower)</match> |
---|
239 | <include> |
---|
240 | <context sub-pattern="1" style-ref="command"/> |
---|
241 | <context sub-pattern="2" style-ref="parameter"/> |
---|
242 | </include> |
---|
243 | </context> |
---|
244 | |
---|
245 | <context id="copyright-command"> |
---|
246 | <match>^\s*(\*copyright)\s+(\%{date})\s+(.+)</match> |
---|
247 | <include> |
---|
248 | <context sub-pattern="1" style-ref="command"/> |
---|
249 | <context sub-pattern="2" style-ref="number"/> |
---|
250 | </include> |
---|
251 | </context> |
---|
252 | |
---|
253 | <context id="cs-command"> |
---|
254 | <match>^\s*(\*cs)(?:\s+(out))?\s+(\%{coordinate-system})</match> |
---|
255 | <include> |
---|
256 | <context sub-pattern="1" style-ref="command"/> |
---|
257 | <context sub-pattern="2" style-ref="parameter"/> |
---|
258 | <context sub-pattern="3" style-ref="parameter"/> |
---|
259 | </include> |
---|
260 | </context> |
---|
261 | |
---|
262 | <context id="data-command"> |
---|
263 | <match>^\s*(\*data)\s+(\%{data-style})((?:\s+(?:\%{data-instruments}))*)</match> |
---|
264 | <include> |
---|
265 | <context sub-pattern="1" style-ref="command"/> |
---|
266 | <context sub-pattern="2" style-ref="parameter"/> |
---|
267 | <context sub-pattern="3" style-ref="parameter"/> |
---|
268 | </include> |
---|
269 | </context> |
---|
270 | |
---|
271 | <context id="date-command"> |
---|
272 | <match>^\s*(\*date)\s+(\%{date})</match> |
---|
273 | <include> |
---|
274 | <context sub-pattern="1" style-ref="command"/> |
---|
275 | <context sub-pattern="2" style-ref="number"/> |
---|
276 | </include> |
---|
277 | </context> |
---|
278 | |
---|
279 | <context id="declination-command"> |
---|
280 | <match>^\s*(\*declination)\s+(?:(auto)|(?:(\%{number})\s+(\%{unit})))</match> |
---|
281 | <include> |
---|
282 | <context sub-pattern="1" style-ref="command"/> |
---|
283 | <context sub-pattern="2" style-ref="parameter"/> |
---|
284 | <context sub-pattern="3" style-ref="number"/> |
---|
285 | <context sub-pattern="4" style-ref="parameter"/> |
---|
286 | </include> |
---|
287 | </context> |
---|
288 | |
---|
289 | <context id="default-command"> |
---|
290 | <match>^\s*(\*default)\s+(all|calibrate|data|units)</match> |
---|
291 | <include> |
---|
292 | <context sub-pattern="1" style-ref="command"/> |
---|
293 | <context sub-pattern="2" style-ref="parameter"/> |
---|
294 | </include> |
---|
295 | </context> |
---|
296 | |
---|
297 | <context id="end-command"> |
---|
298 | <match>^\s*(\*end)(?:\s+(\%{survey-name}))?</match> |
---|
299 | <include> |
---|
300 | <context sub-pattern="1" style-ref="command"/> |
---|
301 | <context sub-pattern="2" style-ref="identifier"/> |
---|
302 | </include> |
---|
303 | </context> |
---|
304 | |
---|
305 | <context id="entrance-command"> |
---|
306 | <match>^\s*(\*entrance)\s+(\%{station-name})</match> |
---|
307 | <include> |
---|
308 | <context sub-pattern="1" style-ref="command"/> |
---|
309 | <context sub-pattern="2" style-ref="identifier"/> |
---|
310 | </include> |
---|
311 | </context> |
---|
312 | |
---|
313 | <context id="equate-command"> |
---|
314 | <match>^\s*(\*equate)\s+(\%{station-name})((?:\s+(?:\%{station-name}))+)</match> |
---|
315 | <include> |
---|
316 | <context sub-pattern="1" style-ref="command"/> |
---|
317 | <context sub-pattern="2" style-ref="identifier"/> |
---|
318 | <context sub-pattern="3" style-ref="identifier"/> |
---|
319 | </include> |
---|
320 | </context> |
---|
321 | |
---|
322 | <context id="export-command"> |
---|
323 | <match>^\s*(\*export)((?:\s+(?:\%{station-name}))+)</match> |
---|
324 | <include> |
---|
325 | <context sub-pattern="1" style-ref="command"/> |
---|
326 | <context sub-pattern="2" style-ref="identifier"/> |
---|
327 | </include> |
---|
328 | </context> |
---|
329 | |
---|
330 | <context id="fix-command"> |
---|
331 | <match>^\s*(\*fix)\s+(\%{station-name})(\s+reference)?</match> |
---|
332 | <include> |
---|
333 | <context sub-pattern="1" style-ref="command"/> |
---|
334 | <context sub-pattern="2" style-ref="identifier"/> |
---|
335 | <context sub-pattern="3" style-ref="parameter"/> |
---|
336 | </include> |
---|
337 | </context> |
---|
338 | |
---|
339 | <context id="flags-command"> |
---|
340 | <match>^\s*(\*flags)((?:(?:\s+not)?\s+(?:duplicate|splay|surface))+)</match> |
---|
341 | <include> |
---|
342 | <context sub-pattern="1" style-ref="command"/> |
---|
343 | <context sub-pattern="2" style-ref="parameter"/> |
---|
344 | </include> |
---|
345 | </context> |
---|
346 | |
---|
347 | <context id="include-command"> |
---|
348 | <match>^\s*(\*include)\s+(\%{string})</match> |
---|
349 | <include> |
---|
350 | <context sub-pattern="1" style-ref="command"/> |
---|
351 | <context sub-pattern="2" style-ref="literal"/> |
---|
352 | </include> |
---|
353 | </context> |
---|
354 | |
---|
355 | <context id="infer-command"> |
---|
356 | <match>^\s*(\*infer)\s+(plumbs|equates|exports)\s+(on|off)</match> |
---|
357 | <include> |
---|
358 | <context sub-pattern="1" style-ref="command"/> |
---|
359 | <context sub-pattern="2" style-ref="parameter"/> |
---|
360 | <context sub-pattern="3" style-ref="parameter"/> |
---|
361 | </include> |
---|
362 | </context> |
---|
363 | |
---|
364 | <context id="instrument-command"> |
---|
365 | <match>^\s*(\*instrument)\s+([a-z]+)\s+(\%{string})</match> |
---|
366 | <include> |
---|
367 | <context sub-pattern="1" style-ref="command"/> |
---|
368 | <context sub-pattern="2" style-ref="identifier"/> |
---|
369 | <context sub-pattern="3" style-ref="literal"/> |
---|
370 | </include> |
---|
371 | </context> |
---|
372 | |
---|
373 | <context id="prefix-command"> |
---|
374 | <match>^\s*(\*prefix)\s+(\%{survey-name})</match> |
---|
375 | <include> |
---|
376 | <context sub-pattern="1" style-ref="command"/> |
---|
377 | <context sub-pattern="2" style-ref="identifier"/> |
---|
378 | </include> |
---|
379 | </context> |
---|
380 | |
---|
381 | <context id="ref-command"> |
---|
382 | <match>^\s*(\*ref)\s+(\%{string})</match> |
---|
383 | <include> |
---|
384 | <context sub-pattern="1" style-ref="command"/> |
---|
385 | <context sub-pattern="2" style-ref="literal"/> |
---|
386 | </include> |
---|
387 | </context> |
---|
388 | |
---|
389 | <context id="require-command"> |
---|
390 | <match>^\s*(\*require)\s+(\%{string})</match> |
---|
391 | <include> |
---|
392 | <context sub-pattern="1" style-ref="command"/> |
---|
393 | <context sub-pattern="2" style-ref="literal"/> |
---|
394 | </include> |
---|
395 | </context> |
---|
396 | |
---|
397 | <context id="sd-command"> |
---|
398 | <match>^\s*(\*sd)((?:\s+(?:\%{quantity}))+)\s+(\%{number})\s+(\%{unit})</match> |
---|
399 | <include> |
---|
400 | <context sub-pattern="1" style-ref="command"/> |
---|
401 | <context sub-pattern="2" style-ref="parameter"/> |
---|
402 | <context sub-pattern="3" style-ref="number"/> |
---|
403 | <context sub-pattern="4" style-ref="parameter"/> |
---|
404 | </include> |
---|
405 | </context> |
---|
406 | |
---|
407 | <context id="set-command"> |
---|
408 | <match>^\s*(\*set)\s+(\%{set-item})\s+(.+)</match> |
---|
409 | <include> |
---|
410 | <context sub-pattern="1" style-ref="command"/> |
---|
411 | <context sub-pattern="2" style-ref="parameter"/> |
---|
412 | <context sub-pattern="3" style-ref="literal"/> |
---|
413 | </include> |
---|
414 | </context> |
---|
415 | |
---|
416 | <context id="solve-command"> |
---|
417 | <match>^\s*(\*solve)</match> |
---|
418 | <include> |
---|
419 | <context sub-pattern="1" style-ref="command"/> |
---|
420 | </include> |
---|
421 | </context> |
---|
422 | |
---|
423 | <context id="team-command"> |
---|
424 | <match>^\s*(\*team)\s+(\%{string})((?:\s+(?:[a-z]+))+)</match> |
---|
425 | <include> |
---|
426 | <context sub-pattern="1" style-ref="command"/> |
---|
427 | <context sub-pattern="2" style-ref="literal"/> |
---|
428 | <context sub-pattern="3" style-ref="identifier"/> |
---|
429 | </include> |
---|
430 | </context> |
---|
431 | |
---|
432 | <context id="title-command"> |
---|
433 | <match>^\s*(\*title)\s+(\%{string})</match> |
---|
434 | <include> |
---|
435 | <context sub-pattern="1" style-ref="command"/> |
---|
436 | <context sub-pattern="2" style-ref="literal"/> |
---|
437 | </include> |
---|
438 | </context> |
---|
439 | |
---|
440 | <context id="truncate-command"> |
---|
441 | <match>^\s*(\*truncate)\s+(?:(\%{number})|(off))</match> |
---|
442 | <include> |
---|
443 | <context sub-pattern="1" style-ref="command"/> |
---|
444 | <context sub-pattern="2" style-ref="number"/> |
---|
445 | <context sub-pattern="3" style-ref="parameter"/> |
---|
446 | </include> |
---|
447 | </context> |
---|
448 | |
---|
449 | <context id="units-command"> |
---|
450 | <match>^\s*(\*units)((?:\s+(?:\%{quantity}))+)(?:\s+(\%{number}))?\s+(\%{unit})</match> |
---|
451 | <include> |
---|
452 | <context sub-pattern="1" style-ref="command"/> |
---|
453 | <context sub-pattern="2" style-ref="parameter"/> |
---|
454 | <context sub-pattern="3" style-ref="number"/> |
---|
455 | <context sub-pattern="4" style-ref="parameter"/> |
---|
456 | </include> |
---|
457 | </context> |
---|
458 | |
---|
459 | <context id="survex"> |
---|
460 | <include> |
---|
461 | <context ref="string"/> |
---|
462 | <context ref="numeric"/> |
---|
463 | <context ref="station-name"/> |
---|
464 | <context ref="line-comment"/> |
---|
465 | <context ref="alias-command"/> |
---|
466 | <context ref="begin-command"/> |
---|
467 | <context ref="calibrate-command"/> |
---|
468 | <context ref="case-command"/> |
---|
469 | <context ref="copyright-command"/> |
---|
470 | <context ref="cs-command"/> |
---|
471 | <context ref="data-command"/> |
---|
472 | <context ref="date-command"/> |
---|
473 | <context ref="declination-command"/> |
---|
474 | <context ref="default-command"/> |
---|
475 | <context ref="end-command"/> |
---|
476 | <context ref="entrance-command"/> |
---|
477 | <context ref="equate-command"/> |
---|
478 | <context ref="export-command"/> |
---|
479 | <context ref="fix-command"/> |
---|
480 | <context ref="flags-command"/> |
---|
481 | <context ref="include-command"/> |
---|
482 | <context ref="infer-command"/> |
---|
483 | <context ref="instrument-command"/> |
---|
484 | <context ref="prefix-command"/> |
---|
485 | <context ref="ref-command"/> |
---|
486 | <context ref="require-command"/> |
---|
487 | <context ref="sd-command"/> |
---|
488 | <context ref="set-command"/> |
---|
489 | <context ref="solve-command"/> |
---|
490 | <context ref="team-command"/> |
---|
491 | <context ref="title-command"/> |
---|
492 | <context ref="truncate-command"/> |
---|
493 | <context ref="units-command"/> |
---|
494 | </include> |
---|
495 | </context> |
---|
496 | |
---|
497 | </definitions> |
---|
498 | </language> |
---|