Debian Codegraph @

data/syntax/dosbat.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language
3 [
4 <!ENTITY label "[^\s]+">
5 <!ENTITY varname "[A-Za-z_][A-Za-z0-9_.]*"> <!-- valid character in a variable name -->
6 <!ENTITY varname_set "&varname;(?=(\[(&#37;&#37;)?(&varname;|\d+)\]|!&varname;!)?(=|\s*$))|&#37;~?\d|&#37;&#37;(&varname;|[0-9*#])"> <!-- variable in set cmd -->
7 <!ENTITY eop "(?=([\s\\;&quot;&#37;]|$))"> <!-- end of path -->
8 <!ENTITY pathpart "[^\s\\&#37;!;/:*?&quot;&gt;&lt;|&amp;]"> <!-- valid character in a file name -->
9 ]>
10 <language name="MS-DOS Batch" version="8" kateversion="5.62" section="Scripts" extensions="*.bat;*.cmd" mimetype="application/x-dos" casesensitive="0" author="Matthew Woehlke ([email protected])" license="LGPL">
11
12 <!-- (c) 2006, 2009, 2010 Matthew Woehlke ([email protected])
13 Released under the LGPL -->
14
15 <highlighting>
16 <list name="builtins">
17 <item>assoc</item>
18 <item>break</item>
19 <item>cd</item>
20 <item>chdir</item>
21 <item>cls</item>
22 <item>color</item>
23 <item>copy</item>
24 <item>date</item>
25 <item>del</item>
26 <item>dir</item>
27 <item>endlocal</item>
28 <item>erase</item>
29 <item>exit</item>
30 <item>ftype</item>
31 <item>md</item>
32 <item>mkdir</item>
33 <item>move</item>
34 <item>path</item>
35 <item>pause</item>
36 <item>popd</item>
37 <item>prompt</item>
38 <item>pushd</item>
39 <item>rd</item>
40 <item>ren</item>
41 <item>rename</item>
42 <item>rmdir</item>
43 <item>runas</item>
44 <item>setlocal</item>
45 <item>shift</item>
46 <item>start</item>
47 <item>time</item>
48 <item>title</item>
49 <item>type</item>
50 <item>ver</item>
51 <item>verify</item>
52 <item>vol</item>
53 </list>
54
55 <!-- these need special handling -->
56 <list name="special commands">
57 <item>call</item>
58 <item>echo</item>
59 <item>else</item>
60 <item>for</item>
61 <item>in</item>
62 <item>do</item>
63 <item>goto</item>
64 <item>if</item>
65 <item>not</item>
66 <item>rem</item>
67 <item>set</item>
68 </list>
69
70 <list name="commands">
71 <!-- the basics -->
72 <item>at</item>
73 <item>attrib</item>
74 <item>break</item>
75 <item>cacls</item>
76 <item>chcp</item>
77 <item>chkdsk</item>
78 <item>chkntfs</item>
79 <item>cmd</item>
80 <item>comp</item>
81 <item>compact</item>
82 <item>convert</item>
83 <item>diskcomp</item>
84 <item>diskcopy</item>
85 <item>doskey</item>
86 <item>fc</item>
87 <item>find</item>
88 <item>findstr</item>
89 <item>format</item>
90 <item>graftabl</item>
91 <item>help</item>
92 <item>label</item>
93 <item>mode</item>
94 <item>more</item>
95 <item>print</item>
96 <item>recover</item>
97 <item>replace</item>
98 <item>sort</item>
99 <item>subst</item>
100 <item>tree</item>
101 <item>xcopy</item>
102 </list>
103
104 <list name="comparators">
105 <item>EQU</item>
106 <item>NEQ</item>
107 <item>LSS</item>
108 <item>LEQ</item>
109 <item>GTR</item>
110 <item>GEQ</item>
111 </list>
112
113 <contexts>
114 <context attribute="Normal Text" lineEndContext="#stay" name="Start">
115 <DetectSpaces/>
116 <!-- general syntactical stuff -->
117 <keyword attribute="Builtin" context="Command" String="builtins"/>
118 <keyword attribute="Command" context="Command" String="commands"/>
119 <!-- special built-ins -->
120 <WordDetect attribute="Builtin" context="CmdSet" String="set" insensitive="1"/>
121 <WordDetect attribute="Builtin" context="CmdEcho" String="echo" insensitive="1" lookAhead="1"/>
122 <WordDetect attribute="ControlFlow" context="CmdIf" String="if" insensitive="1"/>
123 <WordDetect attribute="ControlFlow" context="#stay" String="else" insensitive="1"/>
124 <WordDetect attribute="ControlFlow" context="CmdFor" String="for" insensitive="1"/>
125 <WordDetect attribute="ControlFlow" context="CmdGoto" String="goto" insensitive="1"/>
126 <WordDetect attribute="Builtin" context="CmdCall" String="call" insensitive="1"/>
127 <WordDetect attribute="Comment" context="Comment" String="rem" insensitive="1"/>
128 <DetectChar attribute="Keyword" context="#stay" char="@"/>
129 <!-- other syntaxes -->
130 <StringDetect attribute="Comment" context="Comment" String="::"/>
131 <DetectChar attribute="Label" context="Label" char=":" firstNonSpace="true"/>
132 <DetectChar attribute="Keyword" context="NestedStart" char="(" beginRegion="body"/>
133 <IncludeRules context="FindRedirections"/>
134 <RegExpr attribute="Path" context="Command" String="[^\s&#37;!;*?&quot;&gt;&lt;|&amp;]+"/>
135 <StringDetect attribute="Keyword" String="||"/>
136 <StringDetect attribute="Keyword" String="&amp;&amp;"/>
137 <DetectChar attribute="Redirection" char="|"/>
138 <DetectChar attribute="Keyword" char="&amp;"/>
139 <IncludeRules context="FindStrings"/>
140 <IncludeRules context="FindSubstitutions"/>
141 </context>
142 <context attribute="Normal Text" lineEndContext="#stay" name="NestedStart">
143 <DetectChar attribute="Keyword" context="#pop" char=")" endRegion="body"/>
144 <IncludeRules context="Start"/>
145 </context>
146
147 <context attribute="Normal Text" lineEndContext="#stay" name="FindBranches">
148 <StringDetect attribute="Keyword" context="#pop" String="||"/>
149 <StringDetect attribute="Keyword" context="#pop" String="&amp;&amp;"/>
150 <DetectChar attribute="Redirection" context="#pop" char="|"/>
151 <DetectChar attribute="Keyword" context="#pop" char="&amp;"/>
152 <DetectChar attribute="Keyword" context="#pop" char=")" endRegion="body"/>
153 </context>
154
155 <context attribute="Normal Text" lineEndContext="#stay" name="FindRedirections">
156 <RegExpr attribute="Redirection" context="Redirection" String="[0-9]*(>>?|&lt;)"/>
157 </context>
158 <context attribute="Normal Text" lineEndContext="#stay" name="Redirection" fallthroughContext="#pop!Path">
159 <DetectSpaces context="#pop!Path"/>
160 <RegExpr attribute="Redirection" context="#pop" String="&amp;[0-9]+|"/>
161 </context>
162
163 <context attribute="Normal Text" lineEndContext="#stay" name="FindStrings">
164 <DetectChar attribute="String" context="String" char="&quot;"/>
165 </context>
166
167 <context attribute="Normal Text" lineEndContext="#stay" name="FindSubstitutions">
168 <Detect2Chars attribute="Escape" context="Substitution" char="%" char1="%"/>
169 <IncludeRules context="FindVariables"/>
170 </context>
171 <context attribute="Normal Text" lineEndContext="#stay" name="Substitution" fallthroughContext="#pop">
172 <RegExpr attribute="Variable Expansion" context="#pop!SubstitutionVariable" String="&varname;(\[(%%)?(&varname;|\d+)\])*(:~(%%&varname;|-?[0-9]+)(,(%%&varname;|-?[0-9]+))?|:[^=]+=[^%]*)?%|[0-9*#]|~[fdpnxsatz]*(\$&varname;:)?[0-9#]|" lookAhead="1"/>
173 <DetectIdentifier attribute="Variable" context="#pop"/>
174 </context>
175 <context attribute="Normal Text" lineEndContext="#stay" name="SubstitutionVariable" fallthroughContext="#pop!VariableRegular1">
176 <DetectChar attribute="Variable Expansion" char="~" context="#pop!VariableModificator"/>
177 </context>
178
179 <context attribute="Normal Text" lineEndContext="#stay" name="FindVariables">
180 <!--
181 %var%
182 %var:~N,N%
183 %var:old=new%
184 %~n1
185 %~$var:1
186 %1
187 %*
188 !var!
189 !var:~N,N!
190 !var:old=new!
191 !%...%!
192
193 prefix:
194 [%!]var[...]
195 [%!]var%%
196 -->
197 <RegExpr attribute="Variable Expansion" context="Variable" String="%(&varname;(\[(%%)?(&varname;|\d+)\])*(:~(%%&varname;|-?[0-9]+)(,(%%&varname;|-?[0-9]+))?|:[^=]+=[^%]*)?%|[0-9*#])|%~[fdpnxsatz]*(\$&varname;:)?[0-9#]|!%(&varname;(\[(%%)?(&varname;|\d+)\]|%%&varname;)*%|[0-9*#])!|!&varname;(\[(%%)?(&varname;|\d+)\]|%%&varname;)*(:~(%%&varname;|-?[0-9]+)(,(%%&varname;|-?[0-9]+))?|:[^=]+=[^!]*)?!" lookAhead="1"/>
198 </context>
199 <context attribute="Normal Text" lineEndContext="#pop" name="Variable">
200 <StringDetect attribute="Variable Expansion" String="%~" context="#pop!VariableModificator"/>
201 <DetectChar attribute="Variable Expansion" char="%" context="#pop!VariableRegular1"/>
202 <DetectChar attribute="Variable Expansion" char="!" context="#pop!VariableRegular2"/>
203 </context>
204 <!-- %~ -->
205 <context attribute="Normal Text" lineEndContext="#pop" name="VariableModificator">
206 <AnyChar attribute="Variable Expansion" String="fdpnxsatz"/>
207 <DetectChar attribute="Variable Expansion" char="$" context="#pop!VariableFind"/>
208 <AnyChar attribute="Variable" String="0123456789#" context="#pop"/>
209 </context>
210 <!-- %~$ -->
211 <context attribute="Normal Text" lineEndContext="#pop" name="VariableFind">
212 <DetectIdentifier attribute="Variable"/>
213 <DetectChar attribute="Variable Expansion" char=":"/>
214 <AnyChar attribute="Variable" String="0123456789#" context="#pop"/>
215 <DetectChar attribute="Variable" char="."/>
216 </context>
217 <!-- % -->
218 <context attribute="Normal Text" lineEndContext="#pop" name="VariableRegular1">
219 <DetectChar attribute="Variable Expansion" char="%" context="#pop"/>
220 <DetectIdentifier attribute="Variable"/>
221 <AnyChar attribute="Variable" String="0123456789*#" context="#pop"/>
222 <StringDetect attribute="Variable Expansion" String=":~" context="#pop!VariableSub"/>
223 <DetectChar attribute="Variable Expansion" char=":" context="#pop!VariableReplace1"/>
224 <IncludeRules context="FindVariableRegularKey"/>
225 <DetectChar attribute="Variable" char="."/>
226 </context>
227 <!-- ! -->
228 <context attribute="Normal Text" lineEndContext="#pop" name="VariableRegular2">
229 <DetectChar attribute="Variable Expansion" char="!" context="#pop"/>
230 <DetectIdentifier attribute="Variable"/>
231 <StringDetect attribute="Variable Expansion" String=":~" context="#pop!VariableSub"/>
232 <DetectChar attribute="Variable Expansion" char=":" context="#pop!VariableReplace2"/>
233 <IncludeRules context="FindVariableRegularKey"/>
234 <IncludeRules context="FindVariableRegularEscaped"/>
235 <DetectChar attribute="Variable Expansion" char="%" context="VariableRegular1"/>
236 <DetectChar attribute="Variable" char="."/>
237 </context>
238 <!-- %% in !var1%%var2! -->
239 <context attribute="Normal Text" lineEndContext="#stay" name="FindVariableRegularEscaped">
240 <StringDetect attribute="Escape" String="%%" context="VariableRegularEscaped"/>
241 </context>
242 <context attribute="Normal Text" lineEndContext="#pop" name="VariableRegularEscaped">
243 <DetectIdentifier attribute="Variable" context="#pop"/>
244 </context>
245 <!-- for [ ... ] -->
246 <context attribute="Normal Text" lineEndContext="#stay" name="FindVariableRegularKey">
247 <DetectChar attribute="Symbol" char="[" context="VariableRegularKey"/>
248 </context>
249 <!-- [ -->
250 <context attribute="String" lineEndContext="#stay" name="VariableRegularKey">
251 <DetectChar attribute="Symbol" char="]" context="#pop"/>
252 <StringDetect attribute="Escape" String="%%" context="VariableRegularKeyVar"/>
253 <IncludeRules context="FindNumber"/>
254 <DetectIdentifier attribute="String"/>
255 </context>
256 <context attribute="Normal Text" lineEndContext="#stay" name="VariableRegularKeyVar" fallthroughContext="#pop">
257 <DetectIdentifier attribute="Variable" context="#pop"/>
258 </context>
259 <!-- %var:~ and !var:~ -->
260 <context attribute="Normal Text" lineEndContext="#pop" name="VariableSub">
261 <StringDetect attribute="Escape" String="%%"/>
262 <AnyChar attribute="Variable Expansion" String="%!" context="#pop"/>
263 <IncludeRules context="FindNumber"/>
264 <DetectIdentifier attribute="Variable"/>
265 <DetectChar attribute="Number" char="-"/>
266 <DetectChar attribute="Variable Expansion" char=","/>
267 <DetectChar attribute="Variable" char="."/>
268 </context>
269 <!-- %var: -->
270 <context attribute="Normal Text" lineEndContext="#pop" name="VariableReplace1">
271 <RegExpr attribute="String" String="[^=]+" context="#pop!VariableReplace1Sep"/>
272 </context>
273 <context attribute="Normal Text" lineEndContext="#pop" name="VariableReplace1Sep">
274 <DetectChar attribute="Variable Expansion" char="=" context="#pop!VariableReplace1P2"/>
275 </context>
276 <context attribute="Normal Text" lineEndContext="#pop" name="VariableReplace1P2">
277 <DetectChar attribute="Variable Expansion" char="%" context="#pop"/>
278 <RegExpr attribute="String" String="[^%]+"/>
279 </context>
280 <!-- !var: -->
281 <context attribute="Normal Text" lineEndContext="#pop" name="VariableReplace2">
282 <RegExpr attribute="String" String="[^=]+" context="#pop!VariableReplace2Sep"/>
283 </context>
284 <context attribute="Normal Text" lineEndContext="#pop" name="VariableReplace2Sep">
285 <DetectChar attribute="Variable Expansion" char="=" context="#pop!VariableReplace2P2"/>
286 </context>
287 <context attribute="Normal Text" lineEndContext="#pop" name="VariableReplace2P2">
288 <DetectChar attribute="Variable Expansion" char="!" context="#pop"/>
289 <RegExpr attribute="String" String="[^!]+"/>
290 </context>
291
292 <!-- basic sub-contexts -->
293 <context attribute="Comment" lineEndContext="#pop" name="Comment">
294 <DetectSpaces/>
295 <IncludeRules context="##Comments"/>
296 <DetectIdentifier/>
297 <IncludeRules context="FindUnquotedStringEscape"/>
298 <AnyChar attribute="Error" String="&amp;|^&lt;>()"/>
299 </context>
300
301 <context attribute="String" lineEndContext="#pop" name="String">
302 <DetectSpaces attribute="String"/>
303 <Detect2Chars attribute="Escape" char="\" char1="&quot;"/>
304 <Detect2Chars attribute="Escape" char="\" char1="\"/>
305 <DetectChar attribute="String" context="#pop" char="&quot;"/>
306 <IncludeRules context="FindSubstitutions"/>
307 <DetectIdentifier attribute="String"/>
308 </context>
309
310 <context attribute="Normal Text" lineEndContext="#pop" name="Command">
311 <DetectSpaces/>
312 <IncludeRules context="FindUnquotedString"/>
313 <IncludeRules context="FindSpecialCommandOption"/>
314 <DetectIdentifier/>
315 </context>
316
317 <context attribute="Normal Text" lineEndContext="#pop" name="FindSpecialCommandOption">
318 <RegExpr attribute="Option" context="#stay" String="[/-][A-Za-z0-9][A-Za-z0-9_]*:?"/>
319 <RegExpr attribute="Path" context="#stay" String="[.]+&eop;|[A-Za-z][A-Za-z.]*:(\\+&pathpart;*)*|&pathpart;*(\\+&pathpart;*)+"/>
320 </context>
321
322 <context attribute="Error" lineEndContext="#pop" name="Label">
323 <RegExpr attribute="Label" context="Comment" String="&label;"/>
324 </context>
325
326 <context attribute="Path" lineEndContext="#pop" name="Path">
327 <IncludeRules context="FindStrings"/>
328 <IncludeRules context="FindSubstitutions"/>
329 <AnyChar attribute="Normal Text" context="#pop" String=" &#9;\%/:*?&quot;&gt;&lt;|&amp;" lookAhead="true"/>
330 <DetectIdentifier/>
331 </context>
332
333 <context attribute="Error" lineEndContext="#pop" name="Error">
334 </context>
335
336 <context attribute="Normal Text" lineEndContext="#pop" name="FindNumber">
337 <HlCHex attribute="Hex"/>
338 <HlCOct attribute="Octal"/>
339 <Int attribute="Number"/>
340 </context>
341
342 <context attribute="Normal Text" lineEndContext="#pop" name="FindUnquotedStringEscape">
343 <RegExpr attribute="Escape" context="#stay" String="\^."/>
344 </context>
345
346 <context attribute="Normal Text" lineEndContext="#pop" name="FindUnquotedString">
347 <IncludeRules context="FindStrings"/>
348 <IncludeRules context="FindSubstitutions"/>
349 <IncludeRules context="FindUnquotedStringEscape"/>
350 <IncludeRules context="FindRedirections"/>
351 <IncludeRules context="FindBranches"/>
352 </context>
353
354 <context attribute="Normal Text" lineEndContext="#pop" name="UnquotedString">
355 <DetectSpaces/>
356 <DetectIdentifier/>
357 <IncludeRules context="FindUnquotedString"/>
358 </context>
359
360 <!-- special sub-contexts -->
361 <context attribute="Error" lineEndContext="#pop" name="CmdSet" fallthroughContext="#pop!Error">
362 <IncludeRules context="CmdSetVar"/>
363 <WordDetect attribute="Option" context="#pop!CmdSetVar" String="/p" insensitive="1"/>
364 <WordDetect attribute="Option" context="#pop!CmdSetExpr" String="/a" insensitive="1"/>
365 </context>
366 <context attribute="Error" lineEndContext="#pop" name="CmdSetVar" fallthroughContext="#pop!Error">
367 <DetectSpaces attribute="Normal Text"/>
368 <DetectChar attribute="String" context="#pop!CmdSetQuotedVar" char="&quot;"/>
369 <RegExpr attribute="Variable" context="#pop!CmdSetVar=" String="&varname_set;"/>
370 <DetectChar attribute="Symbol" context="#pop!UnquotedString" char="="/>
371 </context>
372 <!-- set var -->
373 <context attribute="Error" lineEndContext="#pop" name="CmdSetVar=">
374 <DetectChar attribute="Symbol" context="#pop!UnquotedString" char="="/>
375 <IncludeRules context="FindCmdSetVarSuffix"/>
376 </context>
377 <context attribute="Error" lineEndContext="#pop" name="FindCmdSetVarSuffix">
378 <DetectChar attribute="Variable Expansion" char="!"/>
379 <DetectIdentifier attribute="Variable"/>
380 <IncludeRules context="FindVariableRegularKey"/>
381 </context>
382 <!-- set " -->
383 <context attribute="Error" lineEndContext="#pop" name="CmdSetQuotedVar" fallthroughContext="#pop!Error">
384 <RegExpr attribute="Variable" context="#pop!CmdSetQuotedVar=" String="&varname_set;"/>
385 <DetectChar attribute="Symbol" context="#pop!String" char="="/>
386 <DetectChar attribute="String" context="#pop" char="&quot;"/>
387 </context>
388 <!-- set "var -->
389 <context attribute="Error" lineEndContext="#pop" name="CmdSetQuotedVar=">
390 <DetectChar attribute="Symbol" context="#pop!String" char="="/>
391 <IncludeRules context="FindCmdSetVarSuffix"/>
392 <DetectChar attribute="String" context="#pop" char="&quot;"/>
393 </context>
394
395 <!-- set /a -->
396 <context attribute="Error" lineEndContext="#pop" name="CmdSetExpr" fallthroughContext="#pop!CmdSetUnquotedExpr">
397 <DetectSpaces attribute="Normal Text"/>
398 <DetectChar attribute="String" context="CmdSetQuotedExpr" char="&quot;"/>
399 <DetectIdentifier attribute="Variable" context="CmdSetUnquotedExpr"/>
400 <DetectChar attribute="Keyword" char=","/>
401 </context>
402 <context attribute="Error" lineEndContext="#pop" name="CmdSetQuotedExpr">
403 <IncludeRules context="FindVariables"/>
404 <StringDetect attribute="Operator" String="%%"/>
405 <AnyChar attribute="Operator" String="=*/%+-&amp;^|!~"/>
406 <AnyChar attribute="Symbol" String="()[],"/>
407 <DetectIdentifier attribute="Variable"/>
408 <StringDetect attribute="Operator" String="&lt;&lt;"/>
409 <StringDetect attribute="Operator" String=">>"/>
410 <IncludeRules context="FindNumber"/>
411 <DetectSpaces attribute="Normal Text"/>
412 <DetectChar attribute="String" context="#pop" char="&quot;"/>
413 </context>
414 <context attribute="Error" lineEndContext="#pop" name="CmdSetUnquotedExpr">
415 <AnyChar attribute="Symbol" String="()[]"/>
416 <IncludeRules context="FindUnquotedString"/>
417 <AnyChar attribute="Operator" String="=+-/^*!"/>
418 <DetectChar attribute="Keyword" context="#pop" char=","/>
419 <DetectIdentifier attribute="Variable"/>
420 <IncludeRules context="FindNumber"/>
421 <DetectSpaces attribute="Normal Text"/>
422 </context>
423
424 <!-- echo -->
425 <context attribute="Echoed Text" lineEndContext="#pop" name="CmdEcho">
426 <RegExpr attribute="Builtin" context="#pop" String="echo\s+o(ff|n)\s*(?=[&amp;|]|$)" insensitive="1"/>
427 <StringDetect attribute="Builtin" context="#pop!CmdEcho2" String="echo" insensitive="1"/>
428 </context>
429 <context attribute="Echoed Text" lineEndContext="#pop" name="CmdEcho2">
430 <DetectSpaces/>
431 <IncludeRules context="FindSubstitutions"/>
432 <IncludeRules context="FindUnquotedStringEscape"/>
433 <IncludeRules context="FindRedirections"/>
434 <IncludeRules context="FindBranches"/>
435 <DetectIdentifier/>
436 </context>
437
438 <!-- goto -->
439 <context attribute="Error" lineEndContext="#pop" name="CmdGoto">
440 <DetectSpaces attribute="Normal Text" context="#stay"/>
441 <DetectChar attribute="Label" char=":"/>
442 <RegExpr attribute="Label" context="#pop" String="&label;"/>
443 </context>
444
445 <!-- call -->
446 <context attribute="Error" lineEndContext="#pop" name="CmdCall" fallthroughContext="#pop!Command">
447 <DetectSpaces attribute="Normal Text" context="#stay"/>
448 <DetectChar attribute="Label" char=":"/>
449 <RegExpr attribute="Label" context="#pop!Command" String="&label;"/>
450 </context>
451
452
453 <!-- if -->
454 <context attribute="Normal Text" lineEndContext="#pop" name="CmdIf" fallthroughContext="CmdIfCond">
455 <DetectSpaces/>
456 <StringDetect attribute="Option" String="/i" insensitive="1"/>
457 <WordDetect attribute="Keyword" String="not" insensitive="1"/>
458 </context>
459 <context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCond" fallthroughContext="CmdIfCondCmp">
460 <WordDetect attribute="Option" context="CmdIfCondExist" String="exist" insensitive="1"/>
461 <WordDetect attribute="Option" context="CmdIfCondDefined" String="defined" insensitive="1"/>
462 <WordDetect attribute="Option" context="CmdIfCondNum" String="errorlevel" insensitive="1"/>
463 <WordDetect attribute="Option" context="CmdIfCondNum" String="cmdextversion" insensitive="1"/>
464 </context>
465
466 <!-- if exist -->
467 <context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondExist" fallthroughContext="#pop#pop#pop">
468 <DetectSpaces context="CmdIfCondExistPath"/>
469 </context>
470 <context attribute="Path" lineEndContext="#pop" name="CmdIfCondExistPath" fallthroughContext="#pop#pop#pop#pop">
471 <DetectSpaces context="#pop#pop#pop#pop" attribute="Normal Text"/>
472 <IncludeRules context="FindStrings"/>
473 <IncludeRules context="FindSubstitutions"/>
474 <DetectIdentifier/>
475 </context>
476
477 <!-- if defined -->
478 <context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondDefined" fallthroughContext="#pop#pop#pop">
479 <DetectSpaces/>
480 <DetectIdentifier context="#pop#pop#pop" attribute="Variable"/>
481 </context>
482
483 <!-- if errorlevel | if cmdextversion -->
484 <context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondNum" fallthroughContext="#pop#pop#pop">
485 <DetectSpaces/>
486 <Int context="#pop#pop#pop" attribute="Number"/>
487 <IncludeRules context="FindVariables"/>
488 </context>
489
490 <!-- For
491 if xxx op yyy
492 and
493 if xxx==yyy
494 -->
495 <context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondCmp">
496 <DetectSpaces context="#pop!CmdIfCondCmpOp"/>
497 <IncludeRules context="FindStrings"/>
498 <IncludeRules context="FindSubstitutions"/>
499 <DetectIdentifier/>
500 <StringDetect String="==" attribute="Keyword" context="CmdIfCondCmpOperand2"/>
501 </context>
502 <!-- fallthroughContext for operand as option: if %CasseSensitive% "%a%"=="x" -->
503 <context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondCmpOp" fallthroughContext="#pop#pop">
504 <keyword context="CmdIfCondCmpOpSpace" String="comparators" attribute="Keyword"/>
505 </context>
506 <context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondCmpOpSpace">
507 <DetectSpaces context="#pop!CmdIfCondCmpOperand2"/>
508 <RegExpr String="[^\s]+" attribute="Error" />
509 </context>
510 <context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondCmpOperand2">
511 <DetectSpaces context="#pop#pop#pop#pop"/>
512 <IncludeRules context="FindStrings"/>
513 <IncludeRules context="FindSubstitutions"/>
514 <DetectIdentifier/>
515 </context>
516
517
518 <!-- 'for' sub-contexts -->
519 <context attribute="Error" lineEndContext="#pop" name="CmdFor">
520 <DetectSpaces attribute="Normal Text"/>
521 <RegExpr attribute="Variable" context="CmdForIn" String="%%[a-z#$@]" insensitive="1"/>
522 <StringDetect attribute="Option" context="#stay" String="/d" insensitive="1"/>
523 <StringDetect attribute="Option" context="CmdForR" String="/r" insensitive="1"/>
524 <StringDetect attribute="Option" context="CmdForR" String="/f" insensitive="1"/>
525 <StringDetect attribute="Option" context="CmdForL" String="/l" insensitive="1"/>
526 </context>
527
528 <context attribute="Error" lineEndContext="#pop" name="CmdForIn">
529 <DetectSpaces attribute="Normal Text" context="#stay"/>
530 <WordDetect attribute="Keyword" context="CmdForList" String="in" insensitive="1"/>
531 </context>
532
533 <context attribute="Error" lineEndContext="#pop" name="CmdForList">
534 <DetectSpaces attribute="Normal Text" context="#stay"/>
535 <DetectChar attribute="Keyword" context="CmdForListBody" char="("/>
536 </context>
537
538 <context attribute="Normal Text" lineEndContext="#pop" name="CmdForListBody" fallthroughContext="#pop!CmdForListBodyText">
539 <DetectSpaces/>
540 <AnyChar String="`'" context="#pop!CmdForListBodyStartCmd"/>
541 </context>
542 <context attribute="Normal Text" lineEndContext="#pop" name="CmdForListBodyStartCmd" fallthroughContext="#pop!CmdForListBodyText">
543 <DetectSpaces/>
544 <keyword attribute="Builtin" context="#pop!CmdForListBodyCmd" String="builtins"/>
545 <keyword attribute="Command" context="#pop!CmdForListBodyCmd" String="commands"/>
546 <RegExpr attribute="Path" context="#pop!CmdForListBodyCmd" String="[^\s&#37;!;*?&quot;&gt;&lt;|&amp;]+"/>
547 </context>
548 <context attribute="Normal Text" lineEndContext="#pop" name="CmdForListBodyCmd">
549 <DetectSpaces/>
550 <DetectIdentifier/>
551 <IncludeRules context="FindStrings"/>
552 <IncludeRules context="FindSubstitutions"/>
553 <StringDetect attribute="Escape" context="#pop!CmdForListBodyStartCmd" String="^|"/>
554 <StringDetect attribute="Escape" context="#pop!CmdForListBodyStartCmd" String="^&amp;"/>
555 <IncludeRules context="FindUnquotedStringEscape"/>
556 <IncludeRules context="FindRedirections"/>
557 <IncludeRules context="FindSpecialCommandOption"/>
558 <DetectChar attribute="Keyword" context="CmdForDo" char=")"/>
559 <AnyChar attribute="Error" String="&amp;|^&lt;>()"/>
560 </context>
561 <context attribute="Normal Text" lineEndContext="#pop" name="CmdForListBodyText">
562 <DetectSpaces/>
563 <DetectIdentifier/>
564 <IncludeRules context="FindStrings"/>
565 <IncludeRules context="FindSubstitutions"/>
566 <DetectChar attribute="Keyword" context="CmdForDo" char=")"/>
567 </context>
568
569 <context attribute="Error" lineEndContext="#pop" name="CmdForDo">
570 <DetectSpaces attribute="Normal Text" context="#stay"/>
571 <WordDetect attribute="Keyword" context="#pop#pop#pop#pop#pop" String="do" insensitive="1"/>
572 </context>
573
574 <context attribute="Normal Text" lineEndContext="#pop" name="CmdForR">
575 <DetectSpaces attribute="Normal Text"/>
576 <IncludeRules context="FindStrings"/>
577 <IncludeRules context="FindUnquotedStringEscape"/>
578 <RegExpr attribute="Path" String="([a-z][a-z.]*:)?[.]*\\*[^^\s\\&#37;!;/:*?&quot;&gt;&lt;|&amp;%]*&eop;" insensitive="1"/>
579 <DetectIdentifier attribute="Normal Text"/>
580 <RegExpr attribute="Variable" context="#pop!CmdForIn" String="%%[a-z#$@](?=[$\s])" insensitive="1"/>
581 <IncludeRules context="FindSubstitutions"/>
582 </context>
583
584 <!-- 'for /L' sub-contexts -->
585 <context attribute="Error" lineEndContext="#pop" name="CmdForL">
586 <DetectSpaces attribute="Normal Text" context="#stay"/>
587 <RegExpr attribute="Variable" context="CmdForLIn" String="%%[a-z#$@]" insensitive="1"/>
588 </context>
589
590 <context attribute="Error" lineEndContext="#pop" name="CmdForLIn">
591 <DetectSpaces attribute="Normal Text" context="#stay"/>
592 <WordDetect attribute="Keyword" context="CmdForLRange" String="in" insensitive="1"/>
593 </context>
594
595 <context attribute="Error" lineEndContext="#pop" name="CmdForLRange">
596 <DetectSpaces attribute="Normal Text" context="#stay"/>
597 <DetectChar attribute="Keyword" context="CmdForLStart" char="("/>
598 </context>
599
600 <context attribute="Error" lineEndContext="#pop" name="CmdForLStart">
601 <DetectSpaces attribute="Normal Text"/>
602 <AnyChar attribute="Keyword" String=";,="/>
603 <DetectChar attribute="Number" char="-"/>
604 <IncludeRules context="FindNumber"/>
605 <IncludeRules context="FindVariables"/>
606 <DetectChar attribute="Keyword" context="#pop!CmdForDo" char=")"/>
607 <DetectIdentifier attribute="String"/>
608 </context>
609
610 </contexts>
611
612 <itemDatas>
613 <itemData name="Normal Text" defStyleNum="dsNormal"/>
614 <itemData name="Comment" defStyleNum="dsComment"/>
615 <itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false"/>
616 <itemData name="ControlFlow" defStyleNum="dsControlFlow" spellChecking="false"/>
617 <itemData name="Number" defStyleNum="dsDecVal" spellChecking="false"/>
618 <itemData name="Label" defStyleNum="dsOthers"/>
619 <itemData name="Builtin" defStyleNum="dsBuiltIn"/>
620 <itemData name="Command" defStyleNum="dsKeyword"/>
621 <itemData name="Redirection" defStyleNum="dsKeyword" spellChecking="false"/>
622 <itemData name="String" defStyleNum="dsString"/>
623 <itemData name="Escape" defStyleNum="dsSpecialChar" spellChecking="false"/>
624 <itemData name="Echoed Text" defStyleNum="dsNormal"/>
625 <itemData name="Variable" defStyleNum="dsVariable"/>
626 <itemData name="Variable Expansion" defStyleNum="dsPreprocessor" spellChecking="false"/>
627 <itemData name="Path" defStyleNum="dsNormal"/>
628 <itemData name="Option" defStyleNum="dsAttribute" spellChecking="false"/>
629 <itemData name="Error" defStyleNum="dsError" spellChecking="false"/>
630 <itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/>
631 <itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/>
632 <itemData name="Symbol" defStyleNum="dsNormal" spellChecking="false"/>
633 <itemData name="Operator" defStyleNum="dsOperator" spellChecking="false"/>
634 </itemDatas>
635 </highlighting>
636 <general>
637 <comments>
638 <comment name="singleLine" start="rem "/>
639 </comments>
640 <keywords casesensitive="0" additionalDeliminator="@"/>
641 </general>
642 </language>
643 <!-- kate: replace-tabs on; tab-width 2; indent-width 2; -->