1 <?xml version=
"1.0" encoding=
"UTF-8"?>
3 Authors: Philip Withnall
4 Copyright © 2018 Philip Withnall <philip@tecnocode.co.uk>
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.
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.
16 You should have received a copy of the GNU Lesser General Public License
17 along with this library; if not, see <http://www.gnu.org/licenses/>.
19 Reference: https://survex.com/docs/manual/datafile.htm
21 <language id=
"survex" name=
"Survex" version=
"2.0" _section=
"Source">
23 <property name=
"mimetypes">text/x-survex
</property>
24 <property name=
"globs">*.svx
</property>
25 <property name=
"line-comment-start">;
</property>
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"/>
38 <default-regex-options case-sensitive=
"false"/>
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">
50 <define-regex id=
"string" extended=
"true">
55 <define-regex id=
"data-style" extended=
"true">
66 <define-regex id=
"data-instruments" extended=
"true">
95 <define-regex id=
"coordinate-system" extended=
"true">
110 <!-- FIXME: Should this be the same list as data-instruments? -->
111 <define-regex id=
"quantity" extended=
"true">
145 <!-- FIXME: Should this be the same list as data-instruments? -->
146 <define-regex id=
"calibrate-quantity" extended=
"true">
158 <define-regex id=
"unit" extended=
"true">
174 <define-regex id=
"set-item" extended=
"true">
188 <context id=
"string" style-ref=
"literal" end-at-line-end=
"true">
193 <context id=
"numeric" style-ref=
"number">
194 <match>(\%{number})
</match>
197 <context id=
"station-name" style-ref=
"number">
198 <match>(\%{station-name})
</match>
201 <context id=
"line-comment" style-ref=
"comment" end-at-line-end=
"true">
204 <context ref=
"def:in-line-comment"/>
208 <context id=
"alias-command">
209 <match>^\s*(\*alias)\s+(station)\s+(\%{station-name})(?:\s+(\%{station-name}))?
</match>
211 <context sub-pattern=
"1" style-ref=
"command"/>
212 <context sub-pattern=
"2" style-ref=
"parameter"/>
213 <context sub-pattern=
"3" style-ref=
"identifier"/>
217 <context id=
"begin-command">
218 <match>^\s*(\*begin)(?:\s+(\%{survey-name}))?
</match>
220 <context sub-pattern=
"1" style-ref=
"command"/>
221 <context sub-pattern=
"2" style-ref=
"identifier"/>
225 <context id=
"calibrate-command">
226 <match>^\s*(\*calibrate)(?:(?:((?:\s+(?:\%{calibrate-quantity}))+)\s+(\%{number})(?:\s+(\%{unit}))?(?:\s+(\%{number}))?)|\s+(default))
</match>
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"/>
237 <context id=
"case-command">
238 <match>^\s*(\*case)\s+(preserve|toupper|tolower)
</match>
240 <context sub-pattern=
"1" style-ref=
"command"/>
241 <context sub-pattern=
"2" style-ref=
"parameter"/>
245 <context id=
"copyright-command">
246 <match>^\s*(\*copyright)\s+(\%{date})\s+(.+)
</match>
248 <context sub-pattern=
"1" style-ref=
"command"/>
249 <context sub-pattern=
"2" style-ref=
"number"/>
253 <context id=
"cs-command">
254 <match>^\s*(\*cs)(?:\s+(out))?\s+(\%{coordinate-system})
</match>
256 <context sub-pattern=
"1" style-ref=
"command"/>
257 <context sub-pattern=
"2" style-ref=
"parameter"/>
258 <context sub-pattern=
"3" style-ref=
"parameter"/>
262 <context id=
"data-command">
263 <match>^\s*(\*data)\s+(\%{data-style})((?:\s+(?:\%{data-instruments}))*)
</match>
265 <context sub-pattern=
"1" style-ref=
"command"/>
266 <context sub-pattern=
"2" style-ref=
"parameter"/>
267 <context sub-pattern=
"3" style-ref=
"parameter"/>
271 <context id=
"date-command">
272 <match>^\s*(\*date)\s+(\%{date})
</match>
274 <context sub-pattern=
"1" style-ref=
"command"/>
275 <context sub-pattern=
"2" style-ref=
"number"/>
279 <context id=
"declination-command">
280 <match>^\s*(\*declination)\s+(?:(auto)|(?:(\%{number})\s+(\%{unit})))
</match>
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"/>
289 <context id=
"default-command">
290 <match>^\s*(\*default)\s+(all|calibrate|data|units)
</match>
292 <context sub-pattern=
"1" style-ref=
"command"/>
293 <context sub-pattern=
"2" style-ref=
"parameter"/>
297 <context id=
"end-command">
298 <match>^\s*(\*end)(?:\s+(\%{survey-name}))?
</match>
300 <context sub-pattern=
"1" style-ref=
"command"/>
301 <context sub-pattern=
"2" style-ref=
"identifier"/>
305 <context id=
"entrance-command">
306 <match>^\s*(\*entrance)\s+(\%{station-name})
</match>
308 <context sub-pattern=
"1" style-ref=
"command"/>
309 <context sub-pattern=
"2" style-ref=
"identifier"/>
313 <context id=
"equate-command">
314 <match>^\s*(\*equate)\s+(\%{station-name})((?:\s+(?:\%{station-name}))+)
</match>
316 <context sub-pattern=
"1" style-ref=
"command"/>
317 <context sub-pattern=
"2" style-ref=
"identifier"/>
318 <context sub-pattern=
"3" style-ref=
"identifier"/>
322 <context id=
"export-command">
323 <match>^\s*(\*export)((?:\s+(?:\%{station-name}))+)
</match>
325 <context sub-pattern=
"1" style-ref=
"command"/>
326 <context sub-pattern=
"2" style-ref=
"identifier"/>
330 <context id=
"fix-command">
331 <match>^\s*(\*fix)\s+(\%{station-name})(\s+reference)?
</match>
333 <context sub-pattern=
"1" style-ref=
"command"/>
334 <context sub-pattern=
"2" style-ref=
"identifier"/>
335 <context sub-pattern=
"3" style-ref=
"parameter"/>
339 <context id=
"flags-command">
340 <match>^\s*(\*flags)((?:(?:\s+not)?\s+(?:duplicate|splay|surface))+)
</match>
342 <context sub-pattern=
"1" style-ref=
"command"/>
343 <context sub-pattern=
"2" style-ref=
"parameter"/>
347 <context id=
"include-command">
348 <match>^\s*(\*include)\s+(\%{string})
</match>
350 <context sub-pattern=
"1" style-ref=
"command"/>
351 <context sub-pattern=
"2" style-ref=
"literal"/>
355 <context id=
"infer-command">
356 <match>^\s*(\*infer)\s+(plumbs|equates|exports)\s+(on|off)
</match>
358 <context sub-pattern=
"1" style-ref=
"command"/>
359 <context sub-pattern=
"2" style-ref=
"parameter"/>
360 <context sub-pattern=
"3" style-ref=
"parameter"/>
364 <context id=
"instrument-command">
365 <match>^\s*(\*instrument)\s+([a-z]+)\s+(\%{string})
</match>
367 <context sub-pattern=
"1" style-ref=
"command"/>
368 <context sub-pattern=
"2" style-ref=
"identifier"/>
369 <context sub-pattern=
"3" style-ref=
"literal"/>
373 <context id=
"prefix-command">
374 <match>^\s*(\*prefix)\s+(\%{survey-name})
</match>
376 <context sub-pattern=
"1" style-ref=
"command"/>
377 <context sub-pattern=
"2" style-ref=
"identifier"/>
381 <context id=
"ref-command">
382 <match>^\s*(\*ref)\s+(\%{string})
</match>
384 <context sub-pattern=
"1" style-ref=
"command"/>
385 <context sub-pattern=
"2" style-ref=
"literal"/>
389 <context id=
"require-command">
390 <match>^\s*(\*require)\s+(\%{string})
</match>
392 <context sub-pattern=
"1" style-ref=
"command"/>
393 <context sub-pattern=
"2" style-ref=
"literal"/>
397 <context id=
"sd-command">
398 <match>^\s*(\*sd)((?:\s+(?:\%{quantity}))+)\s+(\%{number})\s+(\%{unit})
</match>
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"/>
407 <context id=
"set-command">
408 <match>^\s*(\*set)\s+(\%{set-item})\s+(.+)
</match>
410 <context sub-pattern=
"1" style-ref=
"command"/>
411 <context sub-pattern=
"2" style-ref=
"parameter"/>
412 <context sub-pattern=
"3" style-ref=
"literal"/>
416 <context id=
"solve-command">
417 <match>^\s*(\*solve)
</match>
419 <context sub-pattern=
"1" style-ref=
"command"/>
423 <context id=
"team-command">
424 <match>^\s*(\*team)\s+(\%{string})((?:\s+(?:[a-z]+))+)
</match>
426 <context sub-pattern=
"1" style-ref=
"command"/>
427 <context sub-pattern=
"2" style-ref=
"literal"/>
428 <context sub-pattern=
"3" style-ref=
"identifier"/>
432 <context id=
"title-command">
433 <match>^\s*(\*title)\s+(\%{string})
</match>
435 <context sub-pattern=
"1" style-ref=
"command"/>
436 <context sub-pattern=
"2" style-ref=
"literal"/>
440 <context id=
"truncate-command">
441 <match>^\s*(\*truncate)\s+(?:(\%{number})|(off))
</match>
443 <context sub-pattern=
"1" style-ref=
"command"/>
444 <context sub-pattern=
"2" style-ref=
"number"/>
445 <context sub-pattern=
"3" style-ref=
"parameter"/>
449 <context id=
"units-command">
450 <match>^\s*(\*units)((?:\s+(?:\%{quantity}))+)(?:\s+(\%{number}))?\s+(\%{unit})
</match>
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"/>
459 <context id=
"survex">
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"/>