645 lines
31 KiB
XML
645 lines
31 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE language
|
|
[
|
|
<!ENTITY label "[^\s]+">
|
|
<!ENTITY varname "[A-Za-z_][A-Za-z0-9_.]*"> <!-- valid character in a variable name -->
|
|
<!ENTITY varname_set "&varname;(?=(\[(%%)?(&varname;|\d+)\]|!&varname;!)?(=|\s*$))|%~?\d|%%(&varname;|[0-9*#])"> <!-- variable in set cmd -->
|
|
<!ENTITY eop "(?=([\s\\;"%]|$))"> <!-- end of path -->
|
|
<!ENTITY pathpart "[^\s\\%!;/:*?"><|&]"> <!-- valid character in a file name -->
|
|
]>
|
|
<language name="MS-DOS Batch" version="9" kateversion="5.62" section="Scripts" extensions="*.bat;*.cmd" mimetype="application/x-dos" casesensitive="0" author="Matthew Woehlke (mw_triad@users.sourceforge.net)" license="LGPL">
|
|
|
|
<!-- (c) 2006, 2009, 2010 Matthew Woehlke (mw_triad@users.sourceforge.net)
|
|
Released under the LGPL -->
|
|
|
|
<highlighting>
|
|
<list name="builtins">
|
|
<item>assoc</item>
|
|
<item>break</item>
|
|
<item>cd</item>
|
|
<item>chdir</item>
|
|
<item>cls</item>
|
|
<item>color</item>
|
|
<item>copy</item>
|
|
<item>date</item>
|
|
<item>del</item>
|
|
<item>dir</item>
|
|
<item>endlocal</item>
|
|
<item>erase</item>
|
|
<item>exit</item>
|
|
<item>ftype</item>
|
|
<item>md</item>
|
|
<item>mkdir</item>
|
|
<item>move</item>
|
|
<item>path</item>
|
|
<item>pause</item>
|
|
<item>popd</item>
|
|
<item>prompt</item>
|
|
<item>pushd</item>
|
|
<item>rd</item>
|
|
<item>ren</item>
|
|
<item>rename</item>
|
|
<item>rmdir</item>
|
|
<item>runas</item>
|
|
<item>setlocal</item>
|
|
<item>shift</item>
|
|
<item>start</item>
|
|
<item>time</item>
|
|
<item>title</item>
|
|
<item>type</item>
|
|
<item>ver</item>
|
|
<item>verify</item>
|
|
<item>vol</item>
|
|
</list>
|
|
|
|
<!-- these need special handling -->
|
|
<list name="special commands">
|
|
<item>call</item>
|
|
<item>echo</item>
|
|
<item>else</item>
|
|
<item>for</item>
|
|
<item>in</item>
|
|
<item>do</item>
|
|
<item>goto</item>
|
|
<item>if</item>
|
|
<item>not</item>
|
|
<item>rem</item>
|
|
<item>set</item>
|
|
</list>
|
|
|
|
<list name="commands">
|
|
<!-- the basics -->
|
|
<item>at</item>
|
|
<item>attrib</item>
|
|
<item>break</item>
|
|
<item>cacls</item>
|
|
<item>chcp</item>
|
|
<item>chkdsk</item>
|
|
<item>chkntfs</item>
|
|
<item>cmd</item>
|
|
<item>comp</item>
|
|
<item>compact</item>
|
|
<item>convert</item>
|
|
<item>diskcomp</item>
|
|
<item>diskcopy</item>
|
|
<item>doskey</item>
|
|
<item>fc</item>
|
|
<item>find</item>
|
|
<item>findstr</item>
|
|
<item>format</item>
|
|
<item>graftabl</item>
|
|
<item>help</item>
|
|
<item>label</item>
|
|
<item>mode</item>
|
|
<item>more</item>
|
|
<item>print</item>
|
|
<item>recover</item>
|
|
<item>replace</item>
|
|
<item>sort</item>
|
|
<item>subst</item>
|
|
<item>tree</item>
|
|
<item>xcopy</item>
|
|
</list>
|
|
|
|
<list name="comparators">
|
|
<item>EQU</item>
|
|
<item>NEQ</item>
|
|
<item>LSS</item>
|
|
<item>LEQ</item>
|
|
<item>GTR</item>
|
|
<item>GEQ</item>
|
|
</list>
|
|
|
|
<contexts>
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="Start">
|
|
<DetectSpaces/>
|
|
<!-- general syntactical stuff -->
|
|
<keyword attribute="Builtin" context="Command" String="builtins"/>
|
|
<keyword attribute="Command" context="Command" String="commands"/>
|
|
<!-- special built-ins -->
|
|
<WordDetect attribute="Builtin" context="CmdSet" String="set" insensitive="1"/>
|
|
<WordDetect attribute="Builtin" context="CmdEcho" String="echo" insensitive="1" lookAhead="1"/>
|
|
<WordDetect attribute="ControlFlow" context="CmdIf" String="if" insensitive="1"/>
|
|
<WordDetect attribute="ControlFlow" context="#stay" String="else" insensitive="1"/>
|
|
<WordDetect attribute="ControlFlow" context="CmdFor" String="for" insensitive="1"/>
|
|
<WordDetect attribute="ControlFlow" context="CmdGoto" String="goto" insensitive="1"/>
|
|
<WordDetect attribute="Builtin" context="CmdCall" String="call" insensitive="1"/>
|
|
<WordDetect attribute="Comment" context="Comment" String="rem" insensitive="1"/>
|
|
<DetectChar attribute="Keyword" context="#stay" char="@"/>
|
|
<!-- other syntaxes -->
|
|
<StringDetect attribute="Comment" context="Comment" String="::"/>
|
|
<DetectChar attribute="Label" context="Label" char=":" firstNonSpace="true"/>
|
|
<DetectChar attribute="Keyword" context="NestedStart" char="(" beginRegion="body"/>
|
|
<IncludeRules context="FindRedirections"/>
|
|
<RegExpr attribute="Path" context="Command" String="[^\s%!;*?"><|&]+"/>
|
|
<StringDetect attribute="Keyword" String="||"/>
|
|
<StringDetect attribute="Keyword" String="&&"/>
|
|
<DetectChar attribute="Redirection" char="|"/>
|
|
<DetectChar attribute="Keyword" char="&"/>
|
|
<IncludeRules context="FindStrings"/>
|
|
<IncludeRules context="FindSubstitutions"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="NestedStart">
|
|
<DetectChar attribute="Keyword" context="#pop" char=")" endRegion="body"/>
|
|
<IncludeRules context="Start"/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="FindBranches">
|
|
<StringDetect attribute="Keyword" context="#pop" String="||"/>
|
|
<StringDetect attribute="Keyword" context="#pop" String="&&"/>
|
|
<DetectChar attribute="Redirection" context="#pop" char="|"/>
|
|
<DetectChar attribute="Keyword" context="#pop" char="&"/>
|
|
<DetectChar attribute="Keyword" context="#pop" char=")" endRegion="body"/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="FindRedirections">
|
|
<RegExpr attribute="Redirection" context="Redirection" String="[0-9]*(>>?|<)"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="Redirection" fallthroughContext="#pop!Path">
|
|
<DetectSpaces context="#pop!Path"/>
|
|
<RegExpr attribute="Redirection" context="#pop" String="&[0-9]+|"/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="FindStrings">
|
|
<DetectChar attribute="String" context="String" char="""/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="FindSubstitutions">
|
|
<Detect2Chars attribute="Escape" context="Substitution" char="%" char1="%"/>
|
|
<IncludeRules context="FindVariables"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="Substitution" fallthroughContext="#pop">
|
|
<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"/>
|
|
<DetectIdentifier attribute="Variable" context="#pop"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="SubstitutionVariable" fallthroughContext="#pop!VariableRegular1">
|
|
<DetectChar attribute="Variable Expansion" char="~" context="#pop!VariableModificator"/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="FindVariables">
|
|
<!--
|
|
%var%
|
|
%var:~N,N%
|
|
%var:old=new%
|
|
%~n1
|
|
%~$var:1
|
|
%1
|
|
%*
|
|
!var!
|
|
!var:~N,N!
|
|
!var:old=new!
|
|
!%...%!
|
|
|
|
prefix:
|
|
[%!]var[...]
|
|
[%!]var%%
|
|
-->
|
|
<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"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="Variable">
|
|
<StringDetect attribute="Variable Expansion" String="%~" context="#pop!VariableModificator"/>
|
|
<DetectChar attribute="Variable Expansion" char="%" context="#pop!VariableRegular1"/>
|
|
<DetectChar attribute="Variable Expansion" char="!" context="#pop!VariableRegular2"/>
|
|
</context>
|
|
<!-- %~ -->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="VariableModificator">
|
|
<AnyChar attribute="Variable Expansion" String="fdpnxsatz"/>
|
|
<DetectChar attribute="Variable Expansion" char="$" context="#pop!VariableFind"/>
|
|
<AnyChar attribute="Variable" String="0123456789#" context="#pop"/>
|
|
</context>
|
|
<!-- %~$ -->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="VariableFind">
|
|
<DetectIdentifier attribute="Variable"/>
|
|
<DetectChar attribute="Variable Expansion" char=":"/>
|
|
<AnyChar attribute="Variable" String="0123456789#" context="#pop"/>
|
|
<DetectChar attribute="Variable" char="."/>
|
|
</context>
|
|
<!-- % -->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="VariableRegular1">
|
|
<DetectChar attribute="Variable Expansion" char="%" context="#pop"/>
|
|
<DetectIdentifier attribute="Variable"/>
|
|
<AnyChar attribute="Variable" String="0123456789*#" context="#pop"/>
|
|
<StringDetect attribute="Variable Expansion" String=":~" context="#pop!VariableSub"/>
|
|
<DetectChar attribute="Variable Expansion" char=":" context="#pop!VariableReplace1"/>
|
|
<IncludeRules context="FindVariableRegularKey"/>
|
|
<DetectChar attribute="Variable" char="."/>
|
|
</context>
|
|
<!-- ! -->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="VariableRegular2">
|
|
<DetectChar attribute="Variable Expansion" char="!" context="#pop"/>
|
|
<DetectIdentifier attribute="Variable"/>
|
|
<StringDetect attribute="Variable Expansion" String=":~" context="#pop!VariableSub"/>
|
|
<DetectChar attribute="Variable Expansion" char=":" context="#pop!VariableReplace2"/>
|
|
<IncludeRules context="FindVariableRegularKey"/>
|
|
<IncludeRules context="FindVariableRegularEscaped"/>
|
|
<DetectChar attribute="Variable Expansion" char="%" context="VariableRegular1"/>
|
|
<DetectChar attribute="Variable" char="."/>
|
|
</context>
|
|
<!-- %% in !var1%%var2! -->
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="FindVariableRegularEscaped">
|
|
<StringDetect attribute="Escape" String="%%" context="VariableRegularEscaped"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="VariableRegularEscaped">
|
|
<DetectIdentifier attribute="Variable" context="#pop"/>
|
|
</context>
|
|
<!-- for [ ... ] -->
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="FindVariableRegularKey">
|
|
<DetectChar attribute="Symbol" char="[" context="VariableRegularKey"/>
|
|
</context>
|
|
<!-- [ -->
|
|
<context attribute="String" lineEndContext="#stay" name="VariableRegularKey">
|
|
<DetectChar attribute="Symbol" char="]" context="#pop"/>
|
|
<StringDetect attribute="Escape" String="%%" context="VariableRegularKeyVar"/>
|
|
<IncludeRules context="FindNumber"/>
|
|
<DetectIdentifier attribute="String"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#stay" name="VariableRegularKeyVar" fallthroughContext="#pop">
|
|
<DetectIdentifier attribute="Variable" context="#pop"/>
|
|
</context>
|
|
<!-- %var:~ and !var:~ -->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="VariableSub">
|
|
<StringDetect attribute="Escape" String="%%"/>
|
|
<AnyChar attribute="Variable Expansion" String="%!" context="#pop"/>
|
|
<IncludeRules context="FindNumber"/>
|
|
<DetectIdentifier attribute="Variable"/>
|
|
<DetectChar attribute="Number" char="-"/>
|
|
<DetectChar attribute="Variable Expansion" char=","/>
|
|
<DetectChar attribute="Variable" char="."/>
|
|
</context>
|
|
<!-- %var: -->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="VariableReplace1">
|
|
<RegExpr attribute="String" String="[^=]+" context="#pop!VariableReplace1Sep"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="VariableReplace1Sep">
|
|
<DetectChar attribute="Variable Expansion" char="=" context="#pop!VariableReplace1P2"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="VariableReplace1P2">
|
|
<DetectChar attribute="Variable Expansion" char="%" context="#pop"/>
|
|
<RegExpr attribute="String" String="[^%]+"/>
|
|
</context>
|
|
<!-- !var: -->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="VariableReplace2">
|
|
<RegExpr attribute="String" String="[^=]+" context="#pop!VariableReplace2Sep"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="VariableReplace2Sep">
|
|
<DetectChar attribute="Variable Expansion" char="=" context="#pop!VariableReplace2P2"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="VariableReplace2P2">
|
|
<DetectChar attribute="Variable Expansion" char="!" context="#pop"/>
|
|
<RegExpr attribute="String" String="[^!]+"/>
|
|
</context>
|
|
|
|
<!-- basic sub-contexts -->
|
|
<context attribute="Comment" lineEndContext="#pop" name="Comment">
|
|
<DetectSpaces/>
|
|
<IncludeRules context="##Comments"/>
|
|
<DetectIdentifier/>
|
|
<IncludeRules context="FindUnquotedStringEscape"/>
|
|
<AnyChar attribute="Error" String="&|^<>()"/>
|
|
</context>
|
|
|
|
<context attribute="String" lineEndContext="#pop" name="String">
|
|
<DetectSpaces attribute="String"/>
|
|
<Detect2Chars attribute="Escape" char="\" char1="""/>
|
|
<Detect2Chars attribute="Escape" char="\" char1="\"/>
|
|
<DetectChar attribute="String" context="#pop" char="""/>
|
|
<IncludeRules context="FindSubstitutions"/>
|
|
<DetectIdentifier attribute="String"/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="Command">
|
|
<DetectSpaces/>
|
|
<IncludeRules context="FindUnquotedString"/>
|
|
<IncludeRules context="FindSpecialCommandOption"/>
|
|
<DetectIdentifier/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="FindSpecialCommandOption">
|
|
<RegExpr attribute="Option" context="#stay" String="[/-][A-Za-z0-9][A-Za-z0-9_]*:?"/>
|
|
<RegExpr attribute="Path" context="#stay" String="[.]+&eop;|[A-Za-z][A-Za-z.]*:(\\+&pathpart;*)*|&pathpart;*(\\+&pathpart;*)+"/>
|
|
</context>
|
|
|
|
<context attribute="Error" lineEndContext="#pop" name="Label">
|
|
<RegExpr attribute="Label" context="Comment" String="&label;"/>
|
|
</context>
|
|
|
|
<context attribute="Path" lineEndContext="#pop" name="Path">
|
|
<IncludeRules context="FindStrings"/>
|
|
<IncludeRules context="FindSubstitutions"/>
|
|
<AnyChar attribute="Normal Text" context="#pop" String=" 	\%/:*?"><|&" lookAhead="true"/>
|
|
<DetectIdentifier/>
|
|
</context>
|
|
|
|
<context attribute="Error" lineEndContext="#pop" name="Error">
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="FindNumber">
|
|
<HlCHex attribute="Hex"/>
|
|
<HlCOct attribute="Octal"/>
|
|
<Int attribute="Number"/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="FindUnquotedStringEscape">
|
|
<LineContinue attribute="Escape" char="^"/>
|
|
<RegExpr attribute="Escape" context="#stay" String="\^."/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="FindUnquotedString">
|
|
<IncludeRules context="FindStrings"/>
|
|
<IncludeRules context="FindSubstitutions"/>
|
|
<IncludeRules context="FindUnquotedStringEscape"/>
|
|
<IncludeRules context="FindRedirections"/>
|
|
<IncludeRules context="FindBranches"/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="UnquotedString">
|
|
<DetectSpaces/>
|
|
<DetectIdentifier/>
|
|
<IncludeRules context="FindUnquotedString"/>
|
|
</context>
|
|
|
|
<!-- special sub-contexts -->
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdSet" fallthroughContext="#pop!Error">
|
|
<IncludeRules context="CmdSetVar"/>
|
|
<WordDetect attribute="Option" context="#pop!CmdSetVar" String="/p" insensitive="1"/>
|
|
<WordDetect attribute="Option" context="#pop!CmdSetExpr" String="/a" insensitive="1"/>
|
|
</context>
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdSetVar" fallthroughContext="#pop!Error">
|
|
<DetectSpaces attribute="Normal Text"/>
|
|
<DetectChar attribute="String" context="#pop!CmdSetQuotedVar" char="""/>
|
|
<RegExpr attribute="Variable" context="#pop!CmdSetVar=" String="&varname_set;"/>
|
|
<DetectChar attribute="Symbol" context="#pop!UnquotedString" char="="/>
|
|
</context>
|
|
<!-- set var -->
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdSetVar=">
|
|
<DetectChar attribute="Symbol" context="#pop!UnquotedString" char="="/>
|
|
<IncludeRules context="FindCmdSetVarSuffix"/>
|
|
</context>
|
|
<context attribute="Error" lineEndContext="#pop" name="FindCmdSetVarSuffix">
|
|
<DetectChar attribute="Variable Expansion" char="!"/>
|
|
<DetectIdentifier attribute="Variable"/>
|
|
<IncludeRules context="FindVariableRegularKey"/>
|
|
</context>
|
|
<!-- set " -->
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdSetQuotedVar" fallthroughContext="#pop!Error">
|
|
<RegExpr attribute="Variable" context="#pop!CmdSetQuotedVar=" String="&varname_set;"/>
|
|
<DetectChar attribute="Symbol" context="#pop!String" char="="/>
|
|
<DetectChar attribute="String" context="#pop" char="""/>
|
|
</context>
|
|
<!-- set "var -->
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdSetQuotedVar=">
|
|
<DetectChar attribute="Symbol" context="#pop!String" char="="/>
|
|
<IncludeRules context="FindCmdSetVarSuffix"/>
|
|
<DetectChar attribute="String" context="#pop" char="""/>
|
|
</context>
|
|
|
|
<!-- set /a -->
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdSetExpr" fallthroughContext="#pop!CmdSetUnquotedExpr">
|
|
<DetectSpaces attribute="Normal Text"/>
|
|
<DetectChar attribute="String" context="CmdSetQuotedExpr" char="""/>
|
|
<DetectIdentifier attribute="Variable" context="CmdSetUnquotedExpr"/>
|
|
<DetectChar attribute="Keyword" char=","/>
|
|
</context>
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdSetQuotedExpr">
|
|
<IncludeRules context="FindVariables"/>
|
|
<StringDetect attribute="Operator" String="%%"/>
|
|
<AnyChar attribute="Operator" String="=*/%+-&^|!~"/>
|
|
<AnyChar attribute="Symbol" String="()[],"/>
|
|
<DetectIdentifier attribute="Variable"/>
|
|
<StringDetect attribute="Operator" String="<<"/>
|
|
<StringDetect attribute="Operator" String=">>"/>
|
|
<IncludeRules context="FindNumber"/>
|
|
<DetectSpaces attribute="Normal Text"/>
|
|
<DetectChar attribute="String" context="#pop" char="""/>
|
|
</context>
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdSetUnquotedExpr">
|
|
<AnyChar attribute="Symbol" String="()[]"/>
|
|
<IncludeRules context="FindUnquotedString"/>
|
|
<AnyChar attribute="Operator" String="=+-/^*!"/>
|
|
<DetectChar attribute="Keyword" context="#pop" char=","/>
|
|
<DetectIdentifier attribute="Variable"/>
|
|
<IncludeRules context="FindNumber"/>
|
|
<DetectSpaces attribute="Normal Text"/>
|
|
</context>
|
|
|
|
<!-- echo -->
|
|
<context attribute="Echoed Text" lineEndContext="#pop" name="CmdEcho">
|
|
<RegExpr attribute="Builtin" context="#pop" String="echo\s+o(ff|n)\s*(?=[&|]|$)" insensitive="1"/>
|
|
<StringDetect attribute="Builtin" context="#pop!CmdEcho2" String="echo" insensitive="1"/>
|
|
</context>
|
|
<context attribute="Echoed Text" lineEndContext="#pop" name="CmdEcho2">
|
|
<DetectSpaces/>
|
|
<IncludeRules context="FindSubstitutions"/>
|
|
<IncludeRules context="FindUnquotedStringEscape"/>
|
|
<IncludeRules context="FindRedirections"/>
|
|
<IncludeRules context="FindBranches"/>
|
|
<DetectIdentifier/>
|
|
</context>
|
|
|
|
<!-- goto -->
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdGoto">
|
|
<DetectSpaces attribute="Normal Text" context="#stay"/>
|
|
<DetectChar attribute="Label" char=":"/>
|
|
<RegExpr attribute="Label" context="#pop" String="&label;"/>
|
|
</context>
|
|
|
|
<!-- call -->
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdCall" fallthroughContext="#pop!Command">
|
|
<DetectSpaces attribute="Normal Text" context="#stay"/>
|
|
<DetectChar attribute="Label" char=":"/>
|
|
<RegExpr attribute="Label" context="#pop!Command" String="&label;"/>
|
|
</context>
|
|
|
|
|
|
<!-- if -->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdIf" fallthroughContext="CmdIfCond">
|
|
<DetectSpaces/>
|
|
<StringDetect attribute="Option" String="/i" insensitive="1"/>
|
|
<WordDetect attribute="Keyword" String="not" insensitive="1"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCond" fallthroughContext="CmdIfCondCmp">
|
|
<WordDetect attribute="Option" context="CmdIfCondExist" String="exist" insensitive="1"/>
|
|
<WordDetect attribute="Option" context="CmdIfCondDefined" String="defined" insensitive="1"/>
|
|
<WordDetect attribute="Option" context="CmdIfCondNum" String="errorlevel" insensitive="1"/>
|
|
<WordDetect attribute="Option" context="CmdIfCondNum" String="cmdextversion" insensitive="1"/>
|
|
</context>
|
|
|
|
<!-- if exist -->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondExist" fallthroughContext="#pop#pop#pop">
|
|
<DetectSpaces context="CmdIfCondExistPath"/>
|
|
</context>
|
|
<context attribute="Path" lineEndContext="#pop" name="CmdIfCondExistPath" fallthroughContext="#pop#pop#pop#pop">
|
|
<DetectSpaces context="#pop#pop#pop#pop" attribute="Normal Text"/>
|
|
<IncludeRules context="FindStrings"/>
|
|
<IncludeRules context="FindSubstitutions"/>
|
|
<DetectIdentifier/>
|
|
</context>
|
|
|
|
<!-- if defined -->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondDefined" fallthroughContext="#pop#pop#pop">
|
|
<DetectSpaces/>
|
|
<DetectIdentifier context="#pop#pop#pop" attribute="Variable"/>
|
|
</context>
|
|
|
|
<!-- if errorlevel | if cmdextversion -->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondNum" fallthroughContext="#pop#pop#pop">
|
|
<DetectSpaces/>
|
|
<Int context="#pop#pop#pop" attribute="Number"/>
|
|
<IncludeRules context="FindVariables"/>
|
|
</context>
|
|
|
|
<!-- For
|
|
if xxx op yyy
|
|
and
|
|
if xxx==yyy
|
|
-->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondCmp">
|
|
<DetectSpaces context="#pop!CmdIfCondCmpOp"/>
|
|
<IncludeRules context="FindStrings"/>
|
|
<IncludeRules context="FindSubstitutions"/>
|
|
<DetectIdentifier/>
|
|
<StringDetect String="==" attribute="Keyword" context="CmdIfCondCmpOperand2"/>
|
|
</context>
|
|
<!-- fallthroughContext for operand as option: if %CasseSensitive% "%a%"=="x" -->
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondCmpOp" fallthroughContext="#pop#pop">
|
|
<keyword context="CmdIfCondCmpOpSpace" String="comparators" attribute="Keyword"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondCmpOpSpace">
|
|
<DetectSpaces context="#pop!CmdIfCondCmpOperand2"/>
|
|
<RegExpr String="[^\s]+" attribute="Error" />
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdIfCondCmpOperand2">
|
|
<DetectSpaces context="#pop#pop#pop#pop"/>
|
|
<IncludeRules context="FindStrings"/>
|
|
<IncludeRules context="FindSubstitutions"/>
|
|
<DetectIdentifier/>
|
|
</context>
|
|
|
|
|
|
<!-- 'for' sub-contexts -->
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdFor">
|
|
<DetectSpaces attribute="Normal Text"/>
|
|
<RegExpr attribute="Variable" context="CmdForIn" String="%%[a-z#$@]" insensitive="1"/>
|
|
<StringDetect attribute="Option" context="#stay" String="/d" insensitive="1"/>
|
|
<StringDetect attribute="Option" context="CmdForR" String="/r" insensitive="1"/>
|
|
<StringDetect attribute="Option" context="CmdForR" String="/f" insensitive="1"/>
|
|
<StringDetect attribute="Option" context="CmdForL" String="/l" insensitive="1"/>
|
|
</context>
|
|
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdForIn">
|
|
<DetectSpaces attribute="Normal Text" context="#stay"/>
|
|
<WordDetect attribute="Keyword" context="CmdForList" String="in" insensitive="1"/>
|
|
</context>
|
|
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdForList">
|
|
<DetectSpaces attribute="Normal Text" context="#stay"/>
|
|
<DetectChar attribute="Keyword" context="CmdForListBody" char="("/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdForListBody" fallthroughContext="#pop!CmdForListBodyText">
|
|
<DetectSpaces/>
|
|
<AnyChar String="`'" context="#pop!CmdForListBodyStartCmd"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdForListBodyStartCmd" fallthroughContext="#pop!CmdForListBodyText">
|
|
<DetectSpaces/>
|
|
<keyword attribute="Builtin" context="#pop!CmdForListBodyCmd" String="builtins"/>
|
|
<keyword attribute="Command" context="#pop!CmdForListBodyCmd" String="commands"/>
|
|
<RegExpr attribute="Path" context="#pop!CmdForListBodyCmd" String="[^\s%!;*?"><|&]+"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdForListBodyCmd">
|
|
<DetectSpaces/>
|
|
<DetectIdentifier/>
|
|
<IncludeRules context="FindStrings"/>
|
|
<IncludeRules context="FindSubstitutions"/>
|
|
<StringDetect attribute="Escape" context="#pop!CmdForListBodyStartCmd" String="^|"/>
|
|
<StringDetect attribute="Escape" context="#pop!CmdForListBodyStartCmd" String="^&"/>
|
|
<IncludeRules context="FindUnquotedStringEscape"/>
|
|
<IncludeRules context="FindRedirections"/>
|
|
<IncludeRules context="FindSpecialCommandOption"/>
|
|
<DetectChar attribute="Keyword" context="CmdForDo" char=")"/>
|
|
<AnyChar attribute="Error" String="&|^<>()"/>
|
|
</context>
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdForListBodyText">
|
|
<DetectSpaces/>
|
|
<DetectIdentifier/>
|
|
<IncludeRules context="FindStrings"/>
|
|
<IncludeRules context="FindSubstitutions"/>
|
|
<DetectChar attribute="Keyword" context="CmdForDo" char=")"/>
|
|
</context>
|
|
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdForDo">
|
|
<DetectSpaces attribute="Normal Text" context="#stay"/>
|
|
<WordDetect attribute="Keyword" context="#pop#pop#pop#pop#pop" String="do" insensitive="1"/>
|
|
</context>
|
|
|
|
<context attribute="Normal Text" lineEndContext="#pop" name="CmdForR">
|
|
<DetectSpaces attribute="Normal Text"/>
|
|
<IncludeRules context="FindStrings"/>
|
|
<IncludeRules context="FindUnquotedStringEscape"/>
|
|
<RegExpr attribute="Path" String="([a-z][a-z.]*:)?[.]*\\*[^^\s\\%!;/:*?"><|&%]*&eop;" insensitive="1"/>
|
|
<DetectIdentifier attribute="Normal Text"/>
|
|
<RegExpr attribute="Variable" context="#pop!CmdForIn" String="%%[a-z#$@](?=[$\s])" insensitive="1"/>
|
|
<IncludeRules context="FindSubstitutions"/>
|
|
</context>
|
|
|
|
<!-- 'for /L' sub-contexts -->
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdForL">
|
|
<DetectSpaces attribute="Normal Text" context="#stay"/>
|
|
<RegExpr attribute="Variable" context="CmdForLIn" String="%%[a-z#$@]" insensitive="1"/>
|
|
</context>
|
|
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdForLIn">
|
|
<DetectSpaces attribute="Normal Text" context="#stay"/>
|
|
<WordDetect attribute="Keyword" context="CmdForLRange" String="in" insensitive="1"/>
|
|
</context>
|
|
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdForLRange">
|
|
<DetectSpaces attribute="Normal Text" context="#stay"/>
|
|
<DetectChar attribute="Keyword" context="CmdForLStart" char="("/>
|
|
</context>
|
|
|
|
<context attribute="Error" lineEndContext="#pop" name="CmdForLStart">
|
|
<DetectSpaces attribute="Normal Text"/>
|
|
<AnyChar attribute="Keyword" String=";,="/>
|
|
<DetectChar attribute="Number" char="-"/>
|
|
<IncludeRules context="FindNumber"/>
|
|
<IncludeRules context="FindVariables"/>
|
|
<DetectChar attribute="Keyword" context="#pop!CmdForDo" char=")"/>
|
|
<DetectIdentifier attribute="String"/>
|
|
</context>
|
|
|
|
</contexts>
|
|
|
|
<itemDatas>
|
|
<itemData name="Normal Text" defStyleNum="dsNormal"/>
|
|
<itemData name="Comment" defStyleNum="dsComment"/>
|
|
<itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false"/>
|
|
<itemData name="ControlFlow" defStyleNum="dsControlFlow" spellChecking="false"/>
|
|
<itemData name="Number" defStyleNum="dsDecVal" spellChecking="false"/>
|
|
<itemData name="Label" defStyleNum="dsOthers"/>
|
|
<itemData name="Builtin" defStyleNum="dsBuiltIn"/>
|
|
<itemData name="Command" defStyleNum="dsKeyword"/>
|
|
<itemData name="Redirection" defStyleNum="dsKeyword" spellChecking="false"/>
|
|
<itemData name="String" defStyleNum="dsString"/>
|
|
<itemData name="Escape" defStyleNum="dsSpecialChar" spellChecking="false"/>
|
|
<itemData name="Echoed Text" defStyleNum="dsNormal"/>
|
|
<itemData name="Variable" defStyleNum="dsVariable"/>
|
|
<itemData name="Variable Expansion" defStyleNum="dsPreprocessor" spellChecking="false"/>
|
|
<itemData name="Path" defStyleNum="dsNormal"/>
|
|
<itemData name="Option" defStyleNum="dsAttribute" spellChecking="false"/>
|
|
<itemData name="Error" defStyleNum="dsError" spellChecking="false"/>
|
|
<itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/>
|
|
<itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/>
|
|
<itemData name="Symbol" defStyleNum="dsNormal" spellChecking="false"/>
|
|
<itemData name="Operator" defStyleNum="dsOperator" spellChecking="false"/>
|
|
</itemDatas>
|
|
</highlighting>
|
|
<general>
|
|
<comments>
|
|
<comment name="singleLine" start="rem "/>
|
|
</comments>
|
|
<keywords casesensitive="0" additionalDeliminator="@"/>
|
|
</general>
|
|
</language>
|
|
<!-- kate: replace-tabs on; tab-width 2; indent-width 2; -->
|