2 " Language: TeX (core definition)
3 " Maintainer: Nikolai Weibull <now@bitwi.se>
4 " Latest Revision: 2006-04-19
6 if exists("b:current_syntax")
13 " This follows the grouping (sort of) found at
14 " http://www.tug.org/utilities/plain/cseq.html#top-fam
16 syn keyword initexTodo TODO FIXME XXX NOTE
18 syn match initexComment display contains=initexTodo
19 \ '\\\@<!\%(\\\\\)*\zs%.*$'
21 syn match initexDimension display contains=@NoSpell
22 \ '[+-]\=\s*\%(\d\+\%([.,]\d*\)\=\|[.,]\d\+\)\s*\%(true\)\=\s*\%(p[tc]\|in\|bp\|c[mc]\|m[mu]\|dd\|sp\|e[mx]\)\>'
25 \ contains=initexBoxCommand,initexBoxInternalQuantity,
26 \ initexBoxParameterDimen,initexBoxParameterInteger,
27 \ initexBoxParameterToken
29 syn cluster initexCharacter
30 \ contains=initexCharacterCommand,initexCharacterInternalQuantity,
31 \ initexCharacterParameterInteger
33 syn cluster initexDebugging
34 \ contains=initexDebuggingCommand,initexDebuggingParameterInteger,
35 \ initexDebuggingParameterToken
37 syn cluster initexFileIO
38 \ contains=initexFileIOCommand,initexFileIOInternalQuantity,
39 \ initexFileIOParameterToken
41 syn cluster initexFonts
42 \ contains=initexFontsCommand,initexFontsInternalQuantity
44 syn cluster initexGlue
45 \ contains=initexGlueCommand,initexGlueDerivedCommand
47 syn cluster initexHyphenation
48 \ contains=initexHyphenationCommand,initexHyphenationDerivedCommand,
49 \ initexHyphenationInternalQuantity,initexHyphenationParameterInteger
51 syn cluster initexInserts
52 \ contains=initexInsertsCommand,initexInsertsParameterDimen,
53 \ initexInsertsParameterGlue,initexInsertsParameterInteger
56 \ contains=initexJobCommand,initexJobInternalQuantity,
57 \ initexJobParameterInteger
59 syn cluster initexKern
60 \ contains=initexKernCommand,initexKernInternalQuantity
62 syn cluster initexLogic
63 \ contains=initexLogicCommand
65 syn cluster initexMacro
66 \ contains=initexMacroCommand,initexMacroDerivedCommand,
67 \ initexMacroParameterInteger
69 syn cluster initexMarks
70 \ contains=initexMarksCommand
72 syn cluster initexMath
73 \ contains=initexMathCommand,initexMathDerivedCommand,
74 \ initexMathInternalQuantity,initexMathParameterDimen,
75 \ initexMathParameterGlue,initexMathParameterInteger,
76 \ initexMathParameterMuglue,initexMathParameterToken
78 syn cluster initexPage
79 \ contains=initexPageInternalQuantity,initexPageParameterDimen,
80 \ initexPageParameterGlue
82 syn cluster initexParagraph
83 \ contains=initexParagraphCommand,initexParagraphInternalQuantity,
84 \ initexParagraphParameterDimen,initexParagraphParameterGlue,
85 \ initexParagraphParameterInteger,initexParagraphParameterToken
87 syn cluster initexPenalties
88 \ contains=initexPenaltiesCommand,initexPenaltiesInternalQuantity,
89 \ initexPenaltiesParameterInteger
91 syn cluster initexRegisters
92 \ contains=initexRegistersCommand,initexRegistersInternalQuantity
94 syn cluster initexTables
95 \ contains=initexTablesCommand,initexTablesParameterGlue,
96 \ initexTablesParameterToken
98 syn cluster initexCommand
99 \ contains=initexBoxCommand,initexCharacterCommand,
100 \ initexDebuggingCommand,initexFileIOCommand,
101 \ initexFontsCommand,initexGlueCommand,
102 \ initexHyphenationCommand,initexInsertsCommand,
103 \ initexJobCommand,initexKernCommand,initexLogicCommand,
104 \ initexMacroCommand,initexMarksCommand,initexMathCommand,
105 \ initexParagraphCommand,initexPenaltiesCommand,initexRegistersCommand,
106 \ initexTablesCommand
108 syn match initexBoxCommand display contains=@NoSpell
109 \ '\\\%([hv]\=box\|[cx]\=leaders\|copy\|[hv]rule\|lastbox\|setbox\|un[hv]\%(box\|copy\)\|vtop\)\>'
110 syn match initexCharacterCommand display contains=@NoSpell
111 \ '\\\%([] ]\|\%(^^M\|accent\|char\|\%(lower\|upper\)case\|number\|romannumeral\|string\)\>\)'
112 syn match initexDebuggingCommand display contains=@NoSpell
113 \ '\\\%(\%(batch\|\%(non\|error\)stop\|scroll\)mode\|\%(err\)\=message\|meaning\|show\%(box\%(breadth\|depth\)\=\|lists\|the\)\)\>'
114 syn match initexFileIOCommand display contains=@NoSpell
115 \ '\\\%(\%(close\|open\)\%(in\|out\)\|endinput\|immediate\|input\|read\|shipout\|special\|write\)\>'
116 syn match initexFontsCommand display contains=@NoSpell
117 \ '\\\%(/\|fontname\)\>'
118 syn match initexGlueCommand display contains=@NoSpell
119 \ '\\\%([hv]\|un\)skip\>'
120 syn match initexHyphenationCommand display contains=@NoSpell
121 \ '\\\%(discretionary\|hyphenation\|patterns\|setlanguage\)\>'
122 syn match initexInsertsCommand display contains=@NoSpell
123 \ '\\\%(insert\|split\%(bot\|first\)mark\|vsplit\)\>'
124 syn match initexJobCommand display contains=@NoSpell
125 \ '\\\%(dump\|end\|jobname\)\>'
126 syn match initexKernCommand display contains=@NoSpell
127 \ '\\\%(kern\|lower\|move\%(left\|right\)\|raise\|unkern\)\>'
128 syn match initexLogicCommand display contains=@NoSpell
129 \ '\\\%(else\|fi\|if[a-zA-Z@]\+\|or\)\>'
130 " \ '\\\%(else\|fi\|if\%(case\|cat\|dim\|eof\|false\|[hv]box\|[hmv]mode\|inner\|num\|odd\|true\|void\|x\)\=\|or\)\>'
131 syn match initexMacroCommand display contains=@NoSpell
132 \ '\\\%(after\%(assignment\|group\)\|\%(begin\|end\)group\|\%(end\)\=csname\|e\=def\|expandafter\|futurelet\|global\|let\|long\|noexpand\|outer\|relax\|the\)\>'
133 syn match initexMarksCommand display contains=@NoSpell
134 \ '\\\%(bot\|first\|top\)\=mark\>'
135 syn match initexMathCommand display contains=@NoSpell
136 \ '\\\%(abovewithdelims\|delimiter\|display\%(limits\|style\)\|l\=eqno\|left\|\%(no\)\=limits\|math\%(accent\|bin\|char\|choice\|close\|code\|inner\|op\|open\|ord\|punct\|rel\)\|mkern\|mskip\|muskipdef\|nonscript\|\%(over\|under\)line\|radical\|right\|\%(\%(script\)\{1,2}\|text\)style\|vcenter\)\>'
137 syn match initexParagraphCommand display contains=@NoSpell
138 \ '\\\%(ignorespaces\|indent\|no\%(boundary\|indent\)\|par\|vadjust\)\>'
139 syn match initexPenaltiesCommand display contains=@NoSpell
140 \ '\\\%(un\)\=penalty\>'
141 syn match initexRegistersCommand display contains=@NoSpell
142 \ '\\\%(advance\|\%(count\|dimen\|skip\|toks\)def\|divide\|multiply\)\>'
143 syn match initexTablesCommand display contains=@NoSpell
144 \ '\\\%(cr\|crcr\|[hv]align\|noalign\|omit\|span\)\>'
146 syn cluster initexDerivedCommand
147 \ contains=initexGlueDerivedCommand,initexHyphenationDerivedCommand,
148 \ initexMacroDerivedCommand,initexMathDerivedCommand
150 syn match initexGlueDerivedCommand display contains=@NoSpell
151 \ '\\\%([hv]fil\%(l\|neg\)\=\|[hv]ss\)\>'
152 syn match initexHyphenationDerivedCommand display contains=@NoSpell
154 syn match initexMacroDerivedCommand display contains=@NoSpell
156 syn match initexMathDerivedCommand display contains=@NoSpell
157 \ '\\\%(above\|atop\%(withdelims\)\=\|mathchardef\|over\|overwithdelims\)\>'
159 syn cluster initexInternalQuantity
160 \ contains=initexBoxInternalQuantity,initexCharacterInternalQuantity,
161 \ initexFileIOInternalQuantity,initexFontsInternalQuantity,
162 \ initexHyphenationInternalQuantity,initexJobInternalQuantity,
163 \ initexKernInternalQuantity,initexMathInternalQuantity,
164 \ initexPageInternalQuantity,initexParagraphInternalQuantity,
165 \ initexPenaltiesInternalQuantity,initexRegistersInternalQuantity
167 syn match initexBoxInternalQuantity display contains=@NoSpell
168 \ '\\\%(badness\|dp\|ht\|prevdepth\|wd\)\>'
169 syn match initexCharacterInternalQuantity display contains=@NoSpell
170 \ '\\\%(catcode\|chardef\|\%([ul]c\|sf\)code\)\>'
171 syn match initexFileIOInternalQuantity display contains=@NoSpell
173 syn match initexFontsInternalQuantity display contains=@NoSpell
174 \ '\\\%(font\%(dimen\)\=\|nullfont\)\>'
175 syn match initexHyphenationInternalQuantity display contains=@NoSpell
177 syn match initexJobInternalQuantity display contains=@NoSpell
179 syn match initexKernInternalQuantity display contains=@NoSpell
181 syn match initexMathInternalQuantity display contains=@NoSpell
182 \ '\\\%(delcode\|mathcode\|muskip\|\%(\%(script\)\{1,2}\|text\)font\|skewchar\)\>'
183 syn match initexPageInternalQuantity display contains=@NoSpell
184 \ '\\page\%(depth\|fil\{1,3}stretch\|goal\|shrink\|stretch\|total\)\>'
185 syn match initexParagraphInternalQuantity display contains=@NoSpell
186 \ '\\\%(prevgraf\|spacefactor\)\>'
187 syn match initexPenaltiesInternalQuantity display contains=@NoSpell
189 syn match initexRegistersInternalQuantity display contains=@NoSpell
190 \ '\\\%(count\|dimen\|skip\|toks\)\d\+\>'
192 syn cluster initexParameterDimen
193 \ contains=initexBoxParameterDimen,initexInsertsParameterDimen,
194 \ initexMathParameterDimen,initexPageParameterDimen,
195 \ initexParagraphParameterDimen
197 syn match initexBoxParameterDimen display contains=@NoSpell
198 \ '\\\%(boxmaxdepth\|[hv]fuzz\|overfullrule\)\>'
199 syn match initexInsertsParameterDimen display contains=@NoSpell
200 \ '\\splitmaxdepth\>'
201 syn match initexMathParameterDimen display contains=@NoSpell
202 \ '\\\%(delimitershortfall\|display\%(indent\|width\)\|mathsurround\|nulldelimiterspace\|predisplaysize\|scriptspace\)\>'
203 syn match initexPageParameterDimen display contains=@NoSpell
204 \ '\\\%([hv]offset\|maxdepth\|vsize\)\>'
205 syn match initexParagraphParameterDimen display contains=@NoSpell
206 \ '\\\%(emergencystretch\|\%(hang\|par\)indent\|hsize\|lineskiplimit\)\>'
208 syn cluster initexParameterGlue
209 \ contains=initexInsertsParameterGlue,initexMathParameterGlue,
210 \ initexPageParameterGlue,initexParagraphParameterGlue,
211 \ initexTablesParameterGlue
213 syn match initexInsertsParameterGlue display contains=@NoSpell
215 syn match initexMathParameterGlue display contains=@NoSpell
216 \ '\\\%(above\|below\)display\%(short\)\=skip\>'
217 syn match initexPageParameterGlue display contains=@NoSpell
219 syn match initexParagraphParameterGlue display contains=@NoSpell
220 \ '\\\%(baseline\|left\|line\|par\%(fill\)\=\|right\|x\=space\)skip\>'
221 syn match initexTablesParameterGlue display contains=@NoSpell
224 syn cluster initexParameterInteger
225 \ contains=initexBoxParameterInteger,initexCharacterParameterInteger,
226 \ initexDebuggingParameterInteger,initexHyphenationParameterInteger,
227 \ initexInsertsParameterInteger,initexJobParameterInteger,
228 \ initexMacroParameterInteger,initexMathParameterInteger,
229 \ initexParagraphParameterInteger,initexPenaltiesParameterInteger,
231 syn match initexBoxParameterInteger display contains=@NoSpell
233 syn match initexCharacterParameterInteger display contains=@NoSpell
234 \ '\\\%(\%(endline\|escape\|newline\)char\)\>'
235 syn match initexDebuggingParameterInteger display contains=@NoSpell
236 \ '\\\%(errorcontextlines\|pausing\|tracing\%(commands\|lostchars\|macros\|online\|output\|pages\|paragraphs\|restores|stats\)\)\>'
237 syn match initexHyphenationParameterInteger display contains=@NoSpell
238 \ '\\\%(defaulthyphenchar\|language\|\%(left\|right\)hyphenmin\|uchyph\)\>'
239 syn match initexInsertsParameterInteger display contains=@NoSpell
240 \ '\\\%(holdinginserts\)\>'
241 syn match initexJobParameterInteger display contains=@NoSpell
242 \ '\\\%(day\|mag\|maxdeadcycles\|month\|time\|year\)\>'
243 syn match initexMacroParameterInteger display contains=@NoSpell
245 syn match initexMathParameterInteger display contains=@NoSpell
246 \ '\\\%(binoppenalty\|defaultskewchar\|delimiterfactor\|displaywidowpenalty\|fam\|\%(post\|pre\)displaypenalty\|relpenalty\)\>'
247 syn match initexParagraphParameterInteger display contains=@NoSpell
248 \ '\\\%(\%(adj\|\%(double\|final\)hyphen\)demerits\|looseness\|\%(pre\)\=tolerance\)\>'
249 syn match initexPenaltiesParameterInteger display contains=@NoSpell
250 \ '\\\%(broken\|club\|exhyphen\|floating\|hyphen\|interline\|line\|output\|widow\)penalty\>'
252 syn cluster initexParameterMuglue
253 \ contains=initexMathParameterMuglue
255 syn match initexMathParameterMuglue display contains=@NoSpell
256 \ '\\\%(med\|thick\|thin\)muskip\>'
258 syn cluster initexParameterDimen
259 \ contains=initexBoxParameterToken,initexDebuggingParameterToken,
260 \ initexFileIOParameterToken,initexMathParameterToken,
261 \ initexParagraphParameterToken,initexTablesParameterToken
263 syn match initexBoxParameterToken display contains=@NoSpell
265 syn match initexDebuggingParameterToken display contains=@NoSpell
267 syn match initexFileIOParameterToken display contains=@NoSpell
269 syn match initexMathParameterToken display contains=@NoSpell
270 \ '\\every\%(display\|math\)\>'
271 syn match initexParagraphParameterToken display contains=@NoSpell
273 syn match initexTablesParameterToken display contains=@NoSpell
277 hi def link initexCharacter Character
278 hi def link initexNumber Number
280 hi def link initexIdentifier Identifier
282 hi def link initexStatement Statement
283 hi def link initexConditional Conditional
285 hi def link initexPreProc PreProc
286 hi def link initexMacro Macro
288 hi def link initexType Type
290 hi def link initexDebug Debug
292 hi def link initexTodo Todo
293 hi def link initexComment Comment
294 hi def link initexDimension initexNumber
296 hi def link initexCommand initexStatement
297 hi def link initexBoxCommand initexCommand
298 hi def link initexCharacterCommand initexCharacter
299 hi def link initexDebuggingCommand initexDebug
300 hi def link initexFileIOCommand initexCommand
301 hi def link initexFontsCommand initexType
302 hi def link initexGlueCommand initexCommand
303 hi def link initexHyphenationCommand initexCommand
304 hi def link initexInsertsCommand initexCommand
305 hi def link initexJobCommand initexPreProc
306 hi def link initexKernCommand initexCommand
307 hi def link initexLogicCommand initexConditional
308 hi def link initexMacroCommand initexMacro
309 hi def link initexMarksCommand initexCommand
310 hi def link initexMathCommand initexCommand
311 hi def link initexParagraphCommand initexCommand
312 hi def link initexPenaltiesCommand initexCommand
313 hi def link initexRegistersCommand initexCommand
314 hi def link initexTablesCommand initexCommand
316 hi def link initexDerivedCommand initexStatement
317 hi def link initexGlueDerivedCommand initexDerivedCommand
318 hi def link initexHyphenationDerivedCommand initexDerivedCommand
319 hi def link initexMacroDerivedCommand initexDerivedCommand
320 hi def link initexMathDerivedCommand initexDerivedCommand
322 hi def link initexInternalQuantity initexIdentifier
323 hi def link initexBoxInternalQuantity initexInternalQuantity
324 hi def link initexCharacterInternalQuantity initexInternalQuantity
325 hi def link initexFileIOInternalQuantity initexInternalQuantity
326 hi def link initexFontsInternalQuantity initexInternalQuantity
327 hi def link initexHyphenationInternalQuantity initexInternalQuantity
328 hi def link initexJobInternalQuantity initexInternalQuantity
329 hi def link initexKernInternalQuantity initexInternalQuantity
330 hi def link initexMathInternalQuantity initexInternalQuantity
331 hi def link initexPageInternalQuantity initexInternalQuantity
332 hi def link initexParagraphInternalQuantity initexInternalQuantity
333 hi def link initexPenaltiesInternalQuantity initexInternalQuantity
334 hi def link initexRegistersInternalQuantity initexInternalQuantity
336 hi def link initexParameterDimen initexNumber
337 hi def link initexBoxParameterDimen initexParameterDimen
338 hi def link initexInsertsParameterDimen initexParameterDimen
339 hi def link initexMathParameterDimen initexParameterDimen
340 hi def link initexPageParameterDimen initexParameterDimen
341 hi def link initexParagraphParameterDimen initexParameterDimen
343 hi def link initexParameterGlue initexNumber
344 hi def link initexInsertsParameterGlue initexParameterGlue
345 hi def link initexMathParameterGlue initexParameterGlue
346 hi def link initexPageParameterGlue initexParameterGlue
347 hi def link initexParagraphParameterGlue initexParameterGlue
348 hi def link initexTablesParameterGlue initexParameterGlue
350 hi def link initexParameterInteger initexNumber
351 hi def link initexBoxParameterInteger initexParameterInteger
352 hi def link initexCharacterParameterInteger initexParameterInteger
353 hi def link initexDebuggingParameterInteger initexParameterInteger
354 hi def link initexHyphenationParameterInteger initexParameterInteger
355 hi def link initexInsertsParameterInteger initexParameterInteger
356 hi def link initexJobParameterInteger initexParameterInteger
357 hi def link initexMacroParameterInteger initexParameterInteger
358 hi def link initexMathParameterInteger initexParameterInteger
359 hi def link initexParagraphParameterInteger initexParameterInteger
360 hi def link initexPenaltiesParameterInteger initexParameterInteger
362 hi def link initexParameterMuglue initexNumber
363 hi def link initexMathParameterMuglue initexParameterMuglue
365 hi def link initexParameterToken initexIdentifier
366 hi def link initexBoxParameterToken initexParameterToken
367 hi def link initexDebuggingParameterToken initexParameterToken
368 hi def link initexFileIOParameterToken initexParameterToken
369 hi def link initexMathParameterToken initexParameterToken
370 hi def link initexParagraphParameterToken initexParameterToken
371 hi def link initexTablesParameterToken initexParameterToken
373 let b:current_syntax = "initex"
375 let &cpo = s:cpo_save