1 " smcl.vim -- Vim syntax file for smcl files.
2 " Language: SMCL -- Stata Markup and Control Language
3 " Maintainer: Jeff Pitblado <jpitblado@stata.com>
4 " Last Change: 26apr2006
8 " 20mar2003 updated the match definition for cmdab
9 " 14apr2006 'syntax clear' only under version control
10 " check for 'b:current_syntax', removed 'did_smcl_syntax_inits'
11 " 26apr2006 changed 'stata_smcl' to 'smcl'
15 elseif exists("b:current_syntax")
21 syn keyword smclCCLword current_date contained
22 syn keyword smclCCLword current_time contained
23 syn keyword smclCCLword rmsg_time contained
24 syn keyword smclCCLword stata_version contained
25 syn keyword smclCCLword version contained
26 syn keyword smclCCLword born_date contained
27 syn keyword smclCCLword flavor contained
28 syn keyword smclCCLword SE contained
29 syn keyword smclCCLword mode contained
30 syn keyword smclCCLword console contained
31 syn keyword smclCCLword os contained
32 syn keyword smclCCLword osdtl contained
33 syn keyword smclCCLword machine_type contained
34 syn keyword smclCCLword byteorder contained
35 syn keyword smclCCLword sysdir_stata contained
36 syn keyword smclCCLword sysdir_updates contained
37 syn keyword smclCCLword sysdir_base contained
38 syn keyword smclCCLword sysdir_site contained
39 syn keyword smclCCLword sysdir_plus contained
40 syn keyword smclCCLword sysdir_personal contained
41 syn keyword smclCCLword sysdir_oldplace contained
42 syn keyword smclCCLword adopath contained
43 syn keyword smclCCLword pwd contained
44 syn keyword smclCCLword dirsep contained
45 syn keyword smclCCLword max_N_theory contained
46 syn keyword smclCCLword max_N_current contained
47 syn keyword smclCCLword max_k_theory contained
48 syn keyword smclCCLword max_k_current contained
49 syn keyword smclCCLword max_width_theory contained
50 syn keyword smclCCLword max_width_current contained
51 syn keyword smclCCLword max_matsize contained
52 syn keyword smclCCLword min_matsize contained
53 syn keyword smclCCLword max_macrolen contained
54 syn keyword smclCCLword macrolen contained
55 syn keyword smclCCLword max_cmdlen contained
56 syn keyword smclCCLword cmdlen contained
57 syn keyword smclCCLword namelen contained
58 syn keyword smclCCLword mindouble contained
59 syn keyword smclCCLword maxdouble contained
60 syn keyword smclCCLword epsdouble contained
61 syn keyword smclCCLword minfloat contained
62 syn keyword smclCCLword maxfloat contained
63 syn keyword smclCCLword epsfloat contained
64 syn keyword smclCCLword minlong contained
65 syn keyword smclCCLword maxlong contained
66 syn keyword smclCCLword minint contained
67 syn keyword smclCCLword maxint contained
68 syn keyword smclCCLword minbyte contained
69 syn keyword smclCCLword maxbyte contained
70 syn keyword smclCCLword maxstrvarlen contained
71 syn keyword smclCCLword memory contained
72 syn keyword smclCCLword maxvar contained
73 syn keyword smclCCLword matsize contained
74 syn keyword smclCCLword N contained
75 syn keyword smclCCLword k contained
76 syn keyword smclCCLword width contained
77 syn keyword smclCCLword changed contained
78 syn keyword smclCCLword filename contained
79 syn keyword smclCCLword filedate contained
80 syn keyword smclCCLword more contained
81 syn keyword smclCCLword rmsg contained
82 syn keyword smclCCLword dp contained
83 syn keyword smclCCLword linesize contained
84 syn keyword smclCCLword pagesize contained
85 syn keyword smclCCLword logtype contained
86 syn keyword smclCCLword linegap contained
87 syn keyword smclCCLword scrollbufsize contained
88 syn keyword smclCCLword varlabelpos contained
89 syn keyword smclCCLword reventries contained
90 syn keyword smclCCLword graphics contained
91 syn keyword smclCCLword scheme contained
92 syn keyword smclCCLword printcolor contained
93 syn keyword smclCCLword adosize contained
94 syn keyword smclCCLword maxdb contained
95 syn keyword smclCCLword virtual contained
96 syn keyword smclCCLword checksum contained
97 syn keyword smclCCLword timeout1 contained
98 syn keyword smclCCLword timeout2 contained
99 syn keyword smclCCLword httpproxy contained
100 syn keyword smclCCLword h_current contained
101 syn keyword smclCCLword max_matsize contained
102 syn keyword smclCCLword min_matsize contained
103 syn keyword smclCCLword max_macrolen contained
104 syn keyword smclCCLword macrolen contained
105 syn keyword smclCCLword max_cmdlen contained
106 syn keyword smclCCLword cmdlen contained
107 syn keyword smclCCLword namelen contained
108 syn keyword smclCCLword mindouble contained
109 syn keyword smclCCLword maxdouble contained
110 syn keyword smclCCLword epsdouble contained
111 syn keyword smclCCLword minfloat contained
112 syn keyword smclCCLword maxfloat contained
113 syn keyword smclCCLword epsfloat contained
114 syn keyword smclCCLword minlong contained
115 syn keyword smclCCLword maxlong contained
116 syn keyword smclCCLword minint contained
117 syn keyword smclCCLword maxint contained
118 syn keyword smclCCLword minbyte contained
119 syn keyword smclCCLword maxbyte contained
120 syn keyword smclCCLword maxstrvarlen contained
121 syn keyword smclCCLword memory contained
122 syn keyword smclCCLword maxvar contained
123 syn keyword smclCCLword matsize contained
124 syn keyword smclCCLword N contained
125 syn keyword smclCCLword k contained
126 syn keyword smclCCLword width contained
127 syn keyword smclCCLword changed contained
128 syn keyword smclCCLword filename contained
129 syn keyword smclCCLword filedate contained
130 syn keyword smclCCLword more contained
131 syn keyword smclCCLword rmsg contained
132 syn keyword smclCCLword dp contained
133 syn keyword smclCCLword linesize contained
134 syn keyword smclCCLword pagesize contained
135 syn keyword smclCCLword logtype contained
136 syn keyword smclCCLword linegap contained
137 syn keyword smclCCLword scrollbufsize contained
138 syn keyword smclCCLword varlabelpos contained
139 syn keyword smclCCLword reventries contained
140 syn keyword smclCCLword graphics contained
141 syn keyword smclCCLword scheme contained
142 syn keyword smclCCLword printcolor contained
143 syn keyword smclCCLword adosize contained
144 syn keyword smclCCLword maxdb contained
145 syn keyword smclCCLword virtual contained
146 syn keyword smclCCLword checksum contained
147 syn keyword smclCCLword timeout1 contained
148 syn keyword smclCCLword timeout2 contained
149 syn keyword smclCCLword httpproxy contained
150 syn keyword smclCCLword httpproxyhost contained
151 syn keyword smclCCLword httpproxyport contained
152 syn keyword smclCCLword httpproxyauth contained
153 syn keyword smclCCLword httpproxyuser contained
154 syn keyword smclCCLword httpproxypw contained
155 syn keyword smclCCLword trace contained
156 syn keyword smclCCLword tracedepth contained
157 syn keyword smclCCLword tracesep contained
158 syn keyword smclCCLword traceindent contained
159 syn keyword smclCCLword traceexapnd contained
160 syn keyword smclCCLword tracenumber contained
161 syn keyword smclCCLword type contained
162 syn keyword smclCCLword level contained
163 syn keyword smclCCLword seed contained
164 syn keyword smclCCLword searchdefault contained
165 syn keyword smclCCLword pi contained
166 syn keyword smclCCLword rc contained
168 " Directive for the contant and current-value class
169 syn region smclCCL start=/{ccl / end=/}/ oneline contains=smclCCLword
171 " The order of the following syntax definitions is roughly that of the on-line
172 " documentation for smcl in Stata, from within Stata see help smcl.
174 " Format directives for line and paragraph modes
175 syn match smclFormat /{smcl}/
176 syn match smclFormat /{sf\(\|:[^}]\+\)}/
177 syn match smclFormat /{it\(\|:[^}]\+\)}/
178 syn match smclFormat /{bf\(\|:[^}]\+\)}/
179 syn match smclFormat /{inp\(\|:[^}]\+\)}/
180 syn match smclFormat /{input\(\|:[^}]\+\)}/
181 syn match smclFormat /{err\(\|:[^}]\+\)}/
182 syn match smclFormat /{error\(\|:[^}]\+\)}/
183 syn match smclFormat /{res\(\|:[^}]\+\)}/
184 syn match smclFormat /{result\(\|:[^}]\+\)}/
185 syn match smclFormat /{txt\(\|:[^}]\+\)}/
186 syn match smclFormat /{text\(\|:[^}]\+\)}/
187 syn match smclFormat /{com\(\|:[^}]\+\)}/
188 syn match smclFormat /{cmd\(\|:[^}]\+\)}/
189 syn match smclFormat /{cmdab:[^:}]\+:[^:}()]*\(\|:\|:(\|:()\)}/
190 syn match smclFormat /{hi\(\|:[^}]\+\)}/
191 syn match smclFormat /{hilite\(\|:[^}]\+\)}/
192 syn match smclFormat /{ul \(on\|off\)}/
193 syn match smclFormat /{ul:[^}]\+}/
194 syn match smclFormat /{hline\(\| \d\+\| -\d\+\|:[^}]\+\)}/
195 syn match smclFormat /{dup \d\+:[^}]\+}/
196 syn match smclFormat /{c [^}]\+}/
197 syn match smclFormat /{char [^}]\+}/
198 syn match smclFormat /{reset}/
200 " Formatting directives for line mode
201 syn match smclFormat /{title:[^}]\+}/
202 syn match smclFormat /{center:[^}]\+}/
203 syn match smclFormat /{centre:[^}]\+}/
204 syn match smclFormat /{center \d\+:[^}]\+}/
205 syn match smclFormat /{centre \d\+:[^}]\+}/
206 syn match smclFormat /{right:[^}]\+}/
207 syn match smclFormat /{lalign \d\+:[^}]\+}/
208 syn match smclFormat /{ralign \d\+:[^}]\+}/
209 syn match smclFormat /{\.\.\.}/
210 syn match smclFormat /{col \d\+}/
211 syn match smclFormat /{space \d\+}/
212 syn match smclFormat /{tab}/
214 " Formatting directives for paragraph mode
215 syn match smclFormat /{bind:[^}]\+}/
216 syn match smclFormat /{break}/
218 syn match smclFormat /{p}/
219 syn match smclFormat /{p \d\+}/
220 syn match smclFormat /{p \d\+ \d\+}/
221 syn match smclFormat /{p \d\+ \d\+ \d\+}/
222 syn match smclFormat /{pstd}/
223 syn match smclFormat /{psee}/
224 syn match smclFormat /{phang\(\|2\|3\)}/
225 syn match smclFormat /{pmore\(\|2\|3\)}/
226 syn match smclFormat /{pin\(\|2\|3\)}/
227 syn match smclFormat /{p_end}/
229 syn match smclFormat /{opt \w\+\(\|:\w\+\)\(\|([^)}]*)\)}/
231 syn match smclFormat /{opth \w*\(\|:\w\+\)(\w*)}/
232 syn match smclFormat /{opth "\w\+\((\w\+:[^)}]\+)\)"}/
233 syn match smclFormat /{opth \w\+:\w\+(\w\+:[^)}]\+)}/
235 syn match smclFormat /{dlgtab\s*\(\|\d\+\|\d\+\s\+\d\+\):[^}]\+}/
237 syn match smclFormat /{p2colset\s\+\d\+\s\+\d\+\s\+\d\+\s\+\d\+}/
238 syn match smclFormat /{p2col\s\+:[^{}]*}.*{p_end}/
239 syn match smclFormat /{p2col\s\+:{[^{}]*}}.*{p_end}/
240 syn match smclFormat /{p2coldent\s*:[^{}]*}.*{p_end}/
241 syn match smclFormat /{p2coldent\s*:{[^{}]*}}.*{p_end}/
242 syn match smclFormat /{p2line\s*\(\|\d\+\s\+\d\+\)}/
243 syn match smclFormat /{p2colreset}/
245 syn match smclFormat /{synoptset\s\+\d\+\s\+\w\+}/
246 syn match smclFormat /{synopt\s*:[^{}]*}.*{p_end}/
247 syn match smclFormat /{synopt\s*:{[^{}]*}}.*{p_end}/
248 syn match smclFormat /{syntab\s*:[^{}]*}/
249 syn match smclFormat /{synopthdr}/
250 syn match smclFormat /{synoptline}/
252 " Link directive for line and paragraph modes
253 syn match smclLink /{help [^}]\+}/
254 syn match smclLink /{helpb [^}]\+}/
255 syn match smclLink /{help_d:[^}]\+}/
256 syn match smclLink /{search [^}]\+}/
257 syn match smclLink /{search_d:[^}]\+}/
258 syn match smclLink /{browse [^}]\+}/
259 syn match smclLink /{view [^}]\+}/
260 syn match smclLink /{view_d:[^}]\+}/
261 syn match smclLink /{news:[^}]\+}/
262 syn match smclLink /{net [^}]\+}/
263 syn match smclLink /{net_d:[^}]\+}/
264 syn match smclLink /{netfrom_d:[^}]\+}/
265 syn match smclLink /{ado [^}]\+}/
266 syn match smclLink /{ado_d:[^}]\+}/
267 syn match smclLink /{update [^}]\+}/
268 syn match smclLink /{update_d:[^}]\+}/
269 syn match smclLink /{dialog [^}]\+}/
270 syn match smclLink /{back:[^}]\+}/
271 syn match smclLink /{clearmore:[^}]\+}/
272 syn match smclLink /{stata [^}]\+}/
274 syn match smclLink /{newvar\(\|:[^}]\+\)}/
275 syn match smclLink /{var\(\|:[^}]\+\)}/
276 syn match smclLink /{varname\(\|:[^}]\+\)}/
277 syn match smclLink /{vars\(\|:[^}]\+\)}/
278 syn match smclLink /{varlist\(\|:[^}]\+\)}/
279 syn match smclLink /{depvar\(\|:[^}]\+\)}/
280 syn match smclLink /{depvars\(\|:[^}]\+\)}/
281 syn match smclLink /{depvarlist\(\|:[^}]\+\)}/
282 syn match smclLink /{indepvars\(\|:[^}]\+\)}/
284 syn match smclLink /{dtype}/
285 syn match smclLink /{ifin}/
286 syn match smclLink /{weight}/
289 syn region smclComment start=/{\*/ end=/}/ oneline
292 syn region smclString matchgroup=Nothing start=/"/ end=/"/ oneline
293 syn region smclEString matchgroup=Nothing start=/`"/ end=/"'/ oneline contains=smclEString
295 " assign highlight groups
297 hi def link smclEString smclString
299 hi def link smclCCLword Statement
300 hi def link smclCCL Type
301 hi def link smclFormat Statement
302 hi def link smclLink Underlined
303 hi def link smclComment Comment
304 hi def link smclString String
306 let b:current_syntax = "smcl"