1" Vim syntax file
2" Language:         TeX (core definition)
3" Maintainer:       Nikolai Weibull <now@bitwi.se>
4" Latest Revision:  2006-04-19
5
6if exists("b:current_syntax")
7  finish
8endif
9
10let s:cpo_save = &cpo
11set cpo&vim
12
13" This follows the grouping (sort of) found at
14" http://www.tug.org/utilities/plain/cseq.html#top-fam
15
16syn keyword initexTodo                          TODO FIXME XXX NOTE
17
18syn match initexComment                         display contains=initexTodo
19      \ '\\\@<!\%(\\\\\)*\zs%.*$'
20
21syn 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]\)\>'
23
24syn cluster initexBox
25      \ contains=initexBoxCommand,initexBoxInternalQuantity,
26      \ initexBoxParameterDimen,initexBoxParameterInteger,
27      \ initexBoxParameterToken
28
29syn cluster initexCharacter
30      \ contains=initexCharacterCommand,initexCharacterInternalQuantity,
31      \ initexCharacterParameterInteger
32
33syn cluster initexDebugging
34      \ contains=initexDebuggingCommand,initexDebuggingParameterInteger,
35      \ initexDebuggingParameterToken
36
37syn cluster initexFileIO
38      \ contains=initexFileIOCommand,initexFileIOInternalQuantity,
39      \ initexFileIOParameterToken
40
41syn cluster initexFonts
42      \ contains=initexFontsCommand,initexFontsInternalQuantity
43
44syn cluster initexGlue
45      \ contains=initexGlueCommand,initexGlueDerivedCommand
46
47syn cluster initexHyphenation
48      \ contains=initexHyphenationCommand,initexHyphenationDerivedCommand,
49      \ initexHyphenationInternalQuantity,initexHyphenationParameterInteger
50
51syn cluster initexInserts
52      \ contains=initexInsertsCommand,initexInsertsParameterDimen,
53      \ initexInsertsParameterGlue,initexInsertsParameterInteger
54
55syn cluster initexJob
56      \ contains=initexJobCommand,initexJobInternalQuantity,
57      \ initexJobParameterInteger
58
59syn cluster initexKern
60      \ contains=initexKernCommand,initexKernInternalQuantity
61
62syn cluster initexLogic
63      \ contains=initexLogicCommand
64
65syn cluster initexMacro
66      \ contains=initexMacroCommand,initexMacroDerivedCommand,
67      \ initexMacroParameterInteger
68
69syn cluster initexMarks
70      \ contains=initexMarksCommand
71
72syn cluster initexMath
73      \ contains=initexMathCommand,initexMathDerivedCommand,
74      \ initexMathInternalQuantity,initexMathParameterDimen,
75      \ initexMathParameterGlue,initexMathParameterInteger,
76      \ initexMathParameterMuglue,initexMathParameterToken
77
78syn cluster initexPage
79      \ contains=initexPageInternalQuantity,initexPageParameterDimen,
80      \ initexPageParameterGlue
81
82syn cluster initexParagraph
83      \ contains=initexParagraphCommand,initexParagraphInternalQuantity,
84      \ initexParagraphParameterDimen,initexParagraphParameterGlue,
85      \ initexParagraphParameterInteger,initexParagraphParameterToken
86
87syn cluster initexPenalties
88      \ contains=initexPenaltiesCommand,initexPenaltiesInternalQuantity,
89      \ initexPenaltiesParameterInteger
90
91syn cluster initexRegisters
92      \ contains=initexRegistersCommand,initexRegistersInternalQuantity
93
94syn cluster initexTables
95      \ contains=initexTablesCommand,initexTablesParameterGlue,
96      \ initexTablesParameterToken
97
98syn 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
107
108syn match   initexBoxCommand                    display contains=@NoSpell
109      \ '\\\%([hv]\=box\|[cx]\=leaders\|copy\|[hv]rule\|lastbox\|setbox\|un[hv]\%(box\|copy\)\|vtop\)\>'
110syn match   initexCharacterCommand              display contains=@NoSpell
111      \ '\\\%([] ]\|\%(^^M\|accent\|char\|\%(lower\|upper\)case\|number\|romannumeral\|string\)\>\)'
112syn match   initexDebuggingCommand              display contains=@NoSpell
113      \ '\\\%(\%(batch\|\%(non\|error\)stop\|scroll\)mode\|\%(err\)\=message\|meaning\|show\%(box\%(breadth\|depth\)\=\|lists\|the\)\)\>'
114syn match   initexFileIOCommand                 display contains=@NoSpell
115      \ '\\\%(\%(close\|open\)\%(in\|out\)\|endinput\|immediate\|input\|read\|shipout\|special\|write\)\>'
116syn match   initexFontsCommand                  display contains=@NoSpell
117      \ '\\\%(/\|fontname\)\>'
118syn match   initexGlueCommand                   display contains=@NoSpell
119      \ '\\\%([hv]\|un\)skip\>'
120syn match   initexHyphenationCommand            display contains=@NoSpell
121      \ '\\\%(discretionary\|hyphenation\|patterns\|setlanguage\)\>'
122syn match   initexInsertsCommand                display contains=@NoSpell
123      \ '\\\%(insert\|split\%(bot\|first\)mark\|vsplit\)\>'
124syn match   initexJobCommand                    display contains=@NoSpell
125      \ '\\\%(dump\|end\|jobname\)\>'
126syn match   initexKernCommand                   display contains=@NoSpell
127      \ '\\\%(kern\|lower\|move\%(left\|right\)\|raise\|unkern\)\>'
128syn 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\)\>'
131syn 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\)\>'
133syn match   initexMarksCommand                  display contains=@NoSpell
134      \ '\\\%(bot\|first\|top\)\=mark\>'
135syn 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\)\>'
137syn match   initexParagraphCommand              display contains=@NoSpell
138      \ '\\\%(ignorespaces\|indent\|no\%(boundary\|indent\)\|par\|vadjust\)\>'
139syn match   initexPenaltiesCommand              display contains=@NoSpell
140      \ '\\\%(un\)\=penalty\>'
141syn match   initexRegistersCommand              display contains=@NoSpell
142      \ '\\\%(advance\|\%(count\|dimen\|skip\|toks\)def\|divide\|multiply\)\>'
143syn match   initexTablesCommand                 display contains=@NoSpell
144      \ '\\\%(cr\|crcr\|[hv]align\|noalign\|omit\|span\)\>'
145
146syn cluster initexDerivedCommand
147      \ contains=initexGlueDerivedCommand,initexHyphenationDerivedCommand,
148      \ initexMacroDerivedCommand,initexMathDerivedCommand
149
150syn match   initexGlueDerivedCommand            display contains=@NoSpell
151      \ '\\\%([hv]fil\%(l\|neg\)\=\|[hv]ss\)\>'
152syn match   initexHyphenationDerivedCommand     display contains=@NoSpell
153      \ '\\-'
154syn match   initexMacroDerivedCommand           display contains=@NoSpell
155      \ '\\[gx]def\>'
156syn match   initexMathDerivedCommand            display contains=@NoSpell
157      \ '\\\%(above\|atop\%(withdelims\)\=\|mathchardef\|over\|overwithdelims\)\>'
158
159syn cluster initexInternalQuantity
160      \ contains=initexBoxInternalQuantity,initexCharacterInternalQuantity,
161      \ initexFileIOInternalQuantity,initexFontsInternalQuantity,
162      \ initexHyphenationInternalQuantity,initexJobInternalQuantity,
163      \ initexKernInternalQuantity,initexMathInternalQuantity,
164      \ initexPageInternalQuantity,initexParagraphInternalQuantity,
165      \ initexPenaltiesInternalQuantity,initexRegistersInternalQuantity
166
167syn match   initexBoxInternalQuantity           display contains=@NoSpell
168      \ '\\\%(badness\|dp\|ht\|prevdepth\|wd\)\>'
169syn match   initexCharacterInternalQuantity     display contains=@NoSpell
170      \ '\\\%(catcode\|chardef\|\%([ul]c\|sf\)code\)\>'
171syn match   initexFileIOInternalQuantity        display contains=@NoSpell
172      \ '\\inputlineno\>'
173syn match   initexFontsInternalQuantity         display contains=@NoSpell
174      \ '\\\%(font\%(dimen\)\=\|nullfont\)\>'
175syn match   initexHyphenationInternalQuantity   display contains=@NoSpell
176      \ '\\hyphenchar\>'
177syn match   initexJobInternalQuantity           display contains=@NoSpell
178      \ '\\deadcycles\>'
179syn match   initexKernInternalQuantity          display contains=@NoSpell
180      \ '\\lastkern\>'
181syn match   initexMathInternalQuantity          display contains=@NoSpell
182      \ '\\\%(delcode\|mathcode\|muskip\|\%(\%(script\)\{1,2}\|text\)font\|skewchar\)\>'
183syn match   initexPageInternalQuantity          display contains=@NoSpell
184      \ '\\page\%(depth\|fil\{1,3}stretch\|goal\|shrink\|stretch\|total\)\>'
185syn match   initexParagraphInternalQuantity     display contains=@NoSpell
186      \ '\\\%(prevgraf\|spacefactor\)\>'
187syn match   initexPenaltiesInternalQuantity     display contains=@NoSpell
188      \ '\\lastpenalty\>'
189syn match   initexRegistersInternalQuantity     display contains=@NoSpell
190      \ '\\\%(count\|dimen\|skip\|toks\)\d\+\>'
191
192syn cluster initexParameterDimen
193      \ contains=initexBoxParameterDimen,initexInsertsParameterDimen,
194      \ initexMathParameterDimen,initexPageParameterDimen,
195      \ initexParagraphParameterDimen
196
197syn match   initexBoxParameterDimen             display contains=@NoSpell
198      \ '\\\%(boxmaxdepth\|[hv]fuzz\|overfullrule\)\>'
199syn match   initexInsertsParameterDimen         display contains=@NoSpell
200      \ '\\splitmaxdepth\>'
201syn match   initexMathParameterDimen            display contains=@NoSpell
202      \ '\\\%(delimitershortfall\|display\%(indent\|width\)\|mathsurround\|nulldelimiterspace\|predisplaysize\|scriptspace\)\>'
203syn match   initexPageParameterDimen            display contains=@NoSpell
204      \ '\\\%([hv]offset\|maxdepth\|vsize\)\>'
205syn match   initexParagraphParameterDimen       display contains=@NoSpell
206      \ '\\\%(emergencystretch\|\%(hang\|par\)indent\|hsize\|lineskiplimit\)\>'
207
208syn cluster initexParameterGlue
209      \ contains=initexInsertsParameterGlue,initexMathParameterGlue,
210      \ initexPageParameterGlue,initexParagraphParameterGlue,
211      \ initexTablesParameterGlue
212
213syn match   initexInsertsParameterGlue          display contains=@NoSpell
214      \ '\\splittopskip\>'
215syn match   initexMathParameterGlue             display contains=@NoSpell
216      \ '\\\%(above\|below\)display\%(short\)\=skip\>'
217syn match   initexPageParameterGlue             display contains=@NoSpell
218      \ '\\topskip\>'
219syn match   initexParagraphParameterGlue        display contains=@NoSpell
220      \ '\\\%(baseline\|left\|line\|par\%(fill\)\=\|right\|x\=space\)skip\>'
221syn match   initexTablesParameterGlue           display contains=@NoSpell
222      \ '\\tabskip\>'
223
224syn cluster initexParameterInteger
225      \ contains=initexBoxParameterInteger,initexCharacterParameterInteger,
226      \ initexDebuggingParameterInteger,initexHyphenationParameterInteger,
227      \ initexInsertsParameterInteger,initexJobParameterInteger,
228      \ initexMacroParameterInteger,initexMathParameterInteger,
229      \ initexParagraphParameterInteger,initexPenaltiesParameterInteger,
230
231syn match   initexBoxParameterInteger           display contains=@NoSpell
232      \ '\\[hv]badness\>'
233syn match   initexCharacterParameterInteger     display contains=@NoSpell
234      \ '\\\%(\%(endline\|escape\|newline\)char\)\>'
235syn match   initexDebuggingParameterInteger     display contains=@NoSpell
236      \ '\\\%(errorcontextlines\|pausing\|tracing\%(commands\|lostchars\|macros\|online\|output\|pages\|paragraphs\|restores|stats\)\)\>'
237syn match   initexHyphenationParameterInteger   display contains=@NoSpell
238      \ '\\\%(defaulthyphenchar\|language\|\%(left\|right\)hyphenmin\|uchyph\)\>'
239syn match   initexInsertsParameterInteger       display contains=@NoSpell
240      \ '\\\%(holdinginserts\)\>'
241syn match   initexJobParameterInteger           display contains=@NoSpell
242      \ '\\\%(day\|mag\|maxdeadcycles\|month\|time\|year\)\>'
243syn match   initexMacroParameterInteger         display contains=@NoSpell
244      \ '\\globaldefs\>'
245syn match   initexMathParameterInteger          display contains=@NoSpell
246      \ '\\\%(binoppenalty\|defaultskewchar\|delimiterfactor\|displaywidowpenalty\|fam\|\%(post\|pre\)displaypenalty\|relpenalty\)\>'
247syn match   initexParagraphParameterInteger     display contains=@NoSpell
248      \ '\\\%(\%(adj\|\%(double\|final\)hyphen\)demerits\|looseness\|\%(pre\)\=tolerance\)\>'
249syn match   initexPenaltiesParameterInteger     display contains=@NoSpell
250      \ '\\\%(broken\|club\|exhyphen\|floating\|hyphen\|interline\|line\|output\|widow\)penalty\>'
251
252syn cluster initexParameterMuglue
253      \ contains=initexMathParameterMuglue
254
255syn match   initexMathParameterMuglue           display contains=@NoSpell
256      \ '\\\%(med\|thick\|thin\)muskip\>'
257
258syn cluster initexParameterDimen
259      \ contains=initexBoxParameterToken,initexDebuggingParameterToken,
260      \ initexFileIOParameterToken,initexMathParameterToken,
261      \ initexParagraphParameterToken,initexTablesParameterToken
262
263syn match   initexBoxParameterToken             display contains=@NoSpell
264      \ '\\every[hv]box\>'
265syn match   initexDebuggingParameterToken       display contains=@NoSpell
266      \ '\\errhelp\>'
267syn match   initexFileIOParameterToken          display contains=@NoSpell
268      \ '\\output\>'
269syn match   initexMathParameterToken            display contains=@NoSpell
270      \ '\\every\%(display\|math\)\>'
271syn match   initexParagraphParameterToken       display contains=@NoSpell
272      \ '\\everypar\>'
273syn match   initexTablesParameterToken          display contains=@NoSpell
274      \ '\\everycr\>'
275
276
277hi def link initexCharacter                     Character
278hi def link initexNumber                        Number
279
280hi def link initexIdentifier                    Identifier
281
282hi def link initexStatement                     Statement
283hi def link initexConditional                   Conditional
284
285hi def link initexPreProc                       PreProc
286hi def link initexMacro                         Macro
287
288hi def link initexType                          Type
289
290hi def link initexDebug                         Debug
291
292hi def link initexTodo                          Todo
293hi def link initexComment                       Comment
294hi def link initexDimension                     initexNumber
295
296hi def link initexCommand                       initexStatement
297hi def link initexBoxCommand                    initexCommand
298hi def link initexCharacterCommand              initexCharacter
299hi def link initexDebuggingCommand              initexDebug
300hi def link initexFileIOCommand                 initexCommand
301hi def link initexFontsCommand                  initexType
302hi def link initexGlueCommand                   initexCommand
303hi def link initexHyphenationCommand            initexCommand
304hi def link initexInsertsCommand                initexCommand
305hi def link initexJobCommand                    initexPreProc
306hi def link initexKernCommand                   initexCommand
307hi def link initexLogicCommand                  initexConditional
308hi def link initexMacroCommand                  initexMacro
309hi def link initexMarksCommand                  initexCommand
310hi def link initexMathCommand                   initexCommand
311hi def link initexParagraphCommand              initexCommand
312hi def link initexPenaltiesCommand              initexCommand
313hi def link initexRegistersCommand              initexCommand
314hi def link initexTablesCommand                 initexCommand
315
316hi def link initexDerivedCommand                initexStatement
317hi def link initexGlueDerivedCommand            initexDerivedCommand
318hi def link initexHyphenationDerivedCommand     initexDerivedCommand
319hi def link initexMacroDerivedCommand           initexDerivedCommand
320hi def link initexMathDerivedCommand            initexDerivedCommand
321
322hi def link initexInternalQuantity              initexIdentifier
323hi def link initexBoxInternalQuantity           initexInternalQuantity
324hi def link initexCharacterInternalQuantity     initexInternalQuantity
325hi def link initexFileIOInternalQuantity        initexInternalQuantity
326hi def link initexFontsInternalQuantity         initexInternalQuantity
327hi def link initexHyphenationInternalQuantity   initexInternalQuantity
328hi def link initexJobInternalQuantity           initexInternalQuantity
329hi def link initexKernInternalQuantity          initexInternalQuantity
330hi def link initexMathInternalQuantity          initexInternalQuantity
331hi def link initexPageInternalQuantity          initexInternalQuantity
332hi def link initexParagraphInternalQuantity     initexInternalQuantity
333hi def link initexPenaltiesInternalQuantity     initexInternalQuantity
334hi def link initexRegistersInternalQuantity     initexInternalQuantity
335
336hi def link initexParameterDimen                initexNumber
337hi def link initexBoxParameterDimen             initexParameterDimen
338hi def link initexInsertsParameterDimen         initexParameterDimen
339hi def link initexMathParameterDimen            initexParameterDimen
340hi def link initexPageParameterDimen            initexParameterDimen
341hi def link initexParagraphParameterDimen       initexParameterDimen
342
343hi def link initexParameterGlue                 initexNumber
344hi def link initexInsertsParameterGlue          initexParameterGlue
345hi def link initexMathParameterGlue             initexParameterGlue
346hi def link initexPageParameterGlue             initexParameterGlue
347hi def link initexParagraphParameterGlue        initexParameterGlue
348hi def link initexTablesParameterGlue           initexParameterGlue
349
350hi def link initexParameterInteger              initexNumber
351hi def link initexBoxParameterInteger           initexParameterInteger
352hi def link initexCharacterParameterInteger     initexParameterInteger
353hi def link initexDebuggingParameterInteger     initexParameterInteger
354hi def link initexHyphenationParameterInteger   initexParameterInteger
355hi def link initexInsertsParameterInteger       initexParameterInteger
356hi def link initexJobParameterInteger           initexParameterInteger
357hi def link initexMacroParameterInteger         initexParameterInteger
358hi def link initexMathParameterInteger          initexParameterInteger
359hi def link initexParagraphParameterInteger     initexParameterInteger
360hi def link initexPenaltiesParameterInteger     initexParameterInteger
361
362hi def link initexParameterMuglue               initexNumber
363hi def link initexMathParameterMuglue           initexParameterMuglue
364
365hi def link initexParameterToken                initexIdentifier
366hi def link initexBoxParameterToken             initexParameterToken
367hi def link initexDebuggingParameterToken       initexParameterToken
368hi def link initexFileIOParameterToken          initexParameterToken
369hi def link initexMathParameterToken            initexParameterToken
370hi def link initexParagraphParameterToken       initexParameterToken
371hi def link initexTablesParameterToken          initexParameterToken
372
373let b:current_syntax = "initex"
374
375let &cpo = s:cpo_save
376unlet s:cpo_save
377