3 " Maintainer: David Loeffler <dave@cucc.survex.com>
4 " Last Change: 2016-01-01
7 " Note: The definitions below are taken from the Survex user manual as of February 2005, for version 1.0.34; several inconsistencies discovered in the process were clarified by reference to source code. Since updated for version 1.1.8.
9 " Copyright (C) 2005 David Loeffler
10 " Copyright (C) 2006,2016,2017 Olly Betts
12 " This program is free software; you can redistribute it and/or modify
13 " it under the terms of the GNU General Public License as published by
14 " the Free Software Foundation; either version 2 of the License, or
15 " (at your option) any later version.
17 " This program is distributed in the hope that it will be useful,
18 " but WITHOUT ANY WARRANTY; without even the implied warranty of
19 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 " GNU General Public License for more details.
22 " You should have received a copy of the GNU General Public License
23 " along with this program; if not, write to the Free Software
24 " Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 " For version 5.x: Clear all syntax items
27 " For version 6.x: Quit when a syntax file was already loaded
30 elseif exists("b:current_syntax")
37 " * introduces a command
38 syn match svxAsterisk "^\s*\*" nextgroup=SvxCmd,SvxCmdDeprecated skipwhite
40 " Fudgery - this is used to mask out anything else from matching.
41 syn match svxAnything ".*" contained
43 " Command names: these first few take no interesting arguments
44 syn keyword svxCmd contained alias begin cs date declination
45 syn keyword svxCmd contained end entrance equate export
46 syn keyword svxCmd contained include ref require
47 syn keyword svxCmd contained solve title truncate
49 syn keyword svxCmdDeprecated contained default prefix
51 " These commands accept the whole of the rest of the line as argument, irrespective of whitespace.
52 syn keyword svxCmd contained copyright instrument team nextgroup=svxAnything
54 syn keyword svxCmd calibrate sd units contained nextgroup=svxQty skipwhite
55 syn keyword svxQty contained altitude backbearing backclino backlength nextgroup=svxQty,svxUnit skipwhite
56 syn keyword svxQty contained backcompass backgradient backtape bearing clino nextgroup=svxQty,svxUnit skipwhite
57 syn keyword svxQty contained compass count counter declination nextgroup=svxQty,svxUnit skipwhite
58 syn keyword svxQty contained default depth dx dy dz easting gradient nextgroup=svxQty,svxUnit skipwhite
59 syn keyword svxQty contained length level northing plumb position nextgroup=svxQty,svxUnit skipwhite
60 syn keyword svxQty contained tape nextgroup=svxQty,svxUnit skipwhite
62 syn keyword svxCmd case contained nextgroup=svxCase skipwhite
63 syn keyword svxCase contained preserve toupper tolower contained
65 syn keyword svxCmd data contained nextgroup=svxStyle skipwhite
66 syn keyword svxStyle contained default normal diving topofil nextgroup=svxField skipwhite
67 syn keyword svxStyle contained cartesian cylpolar nosurvey nextgroup=svxField skipwhite
68 syn keyword svxStyle contained passage nextgroup=svxField skipwhite
70 syn keyword svxField contained nextgroup=svxField skipwhite altitude backbearing backclino backlength
71 syn keyword svxField contained nextgroup=svxField skipwhite backcompass backgradient backtape bearing clino
72 syn keyword svxField contained nextgroup=svxField skipwhite compass count counter depth depthchange
73 syn keyword svxField contained nextgroup=svxField skipwhite direction dx dy dz easting from
74 syn keyword svxField contained nextgroup=svxField skipwhite fromcount fromdepth gradient ignore
75 syn keyword svxField contained nextgroup=svxField skipwhite ignoreall length newline northing
76 syn keyword svxField contained nextgroup=svxField skipwhite station tape to tocount todepth
77 syn keyword svxField contained nextgroup=svxField skipwhite left right up down ceiling floor
79 syn keyword svxCmd contained nextgroup=svxFlag skipwhite flags
80 syn keyword svxFlag contained nextgroup=svxFlag skipwhite not duplicate surface splay
82 syn keyword svxCmd contained nextgroup=svxInferrable skipwhite infer
83 syn keyword svxInferrable contained nextgroup=svxOnOff skipwhite plumbs equates exports
84 syn keyword svxOnOff contained on off
86 syn keyword svxCmd contained nextgroup=svxVar,svxVarDeprecated skipwhite set
87 syn keyword svxVar contained blank comment decimal eol keyword minus
88 syn keyword svxVar contained names omit plus separator
89 syn keyword svxVarDeprecated contained root
91 syn keyword svxCmd contained nextgroup=svxQty skipwhite units
92 syn keyword svxUnit contained yards feet metric metres meters
93 syn keyword svxUnit contained degs degrees grads mils minutes
94 syn keyword svxUnit contained percent percentage
96 syn keyword svxCmd contained nextgroup=svxRef skipwhite fix
97 syn keyword svxRef contained reference
99 " Miscellaneous things that are spotted everywhere
100 syn keyword svxMisc - down up
103 syn match svxComment ";.*"
105 " Strings (double-quote)
106 syn region svxString start=+"+ end=+"+
108 " Catch errors caused by filenames containing whitespace
109 " This is just an example really, to show the kind of
110 " error-trapping that's possible
111 syn match svxFilenameError "\*include\s*[^"]\+\s\+[^\s"]\+"
113 " Define the default highlighting.
114 " For version 5.7 and earlier: only when not done already
115 " For version 5.8 and later: only when an item doesn't have highlighting yet
116 if version >= 508 || !exists("did_survex_syn_inits")
118 let did_survex_syn_inits = 1
119 command -nargs=+ HiLink hi link <args>
121 command -nargs=+ HiLink hi def link <args>
124 HiLink svxString String
125 HiLink svxComment Comment
126 HiLink svxCmd Statement
128 HiLink svxUnit Identifier
129 HiLink svxQty Identifier
130 HiLink svxCase Identifier
131 HiLink svxField Identifier
132 HiLink svxFlag Identifier
133 HiLink svxInferrable Identifier
134 HiLink svxOnOff Special
135 HiLink svxVar Identifier
136 HiLink svxMisc Special
137 HiLink svxAsterisk Statement
138 HiLink svxFilenameError Error
139 HiLink svxCmdDeprecated Todo
140 HiLink svxVarDeprecated Todo
144 let b:current_syntax = "survex"