Warning, /frameworks/syntax-highlighting/data/syntax/fish.xml is written in an unsupported language. File is not indexed.
0001 <?xml version="1.0" encoding="UTF-8"?>
0002 <!DOCTYPE language
0003 [
0004 <!ENTITY tab "	">
0005 <!ENTITY white "&tab; "> <!-- first is tab -->
0006 <!ENTITY eocommand "&white;<>^"> <!-- end of command separator -->
0007 <!ENTITY separator "&white;|&;<>()'""> <!-- token separator as char list -->
0008 <!ENTITY commandsep "|&;"> <!-- command separator as char list -->
0009 <!ENTITY special "{}*/.?\\$&"> <!-- not allowed in function names -->
0010 <!ENTITY portable_filename "A-Za-z0-9\._-">
0011 <!ENTITY funcname_first "a-zA-Z+:=!.@_`">
0012 <!ENTITY funcname_last "a-zA-Z0-9+,-:=!.@#%^_`~">
0013 <!ENTITY funcname "[&funcname_first;](?:[&funcname_last;]|\\ )*">
0014 <!ENTITY varname "[A-Za-z0-9_]+">
0015 <!ENTITY alnumdash "[A-Za-z0-9-]"> <!-- option chars, dashes for GNU long opts -->
0016 <!ENTITY testoptsfile "[bcdefgGkLOprsStuwx]"> <!-- test operators for file testing -->
0017 <!ENTITY testoptsother "[nzao]"> <!-- other test operators -->
0018 <!ENTITY braceelement "[!#%+\-\./0-9:=@A-Z^_`a-z~]">
0019 <!ENTITY escapechars "[abefnrtv $\\*?~%#(){}[\]<>\^&;"']"> <!-- escape chars -->
0020 <!ENTITY white_or_eol "(?:[&white;]|$)">
0021 <!ENTITY homedir "~[&portable_filename;]*">
0022 <!ENTITY pathdetect "(?:(?:\.\.?|&homedir;)&white_or_eol;|(?:[^$\\{}&separator;/\*\?]|\\&escapechars;)*(:?[/?]|\*\*?))">
0023 <!ENTITY pathpart "(?:[^&separator;/]|\\&escapechars;)*(?:/|(?=["']))">
0024 <!ENTITY command "([-\w+,-:=!.@#%^_`~]+|\\ )+">
0025 ]>
0026
0027
0028 <language name="Fish" version="9" kateversion="5.72" section="Scripts" extensions="*.fish;fishd.*" mimetype="application/x-fish" casesensitive="1" author="Arnd Diestelhorst (adiestelhorst@m-xchg.de)" license="LGPL">
0029
0030
0031 <highlighting>
0032
0033 <list name= "commands">
0034 <item>abbr</item>
0035 <item>alias</item>
0036 <item>argparse</item>
0037 <item>bg</item>
0038 <item>bind</item>
0039 <item>block</item>
0040 <item>cd</item>
0041 <item>cdh</item>
0042 <item>commandline</item>
0043 <item>complete</item>
0044 <item>contains</item>
0045 <item>count</item>
0046 <item>dirs</item>
0047 <item>disown</item>
0048 <item>echo</item>
0049 <item>emit</item>
0050 <item>end</item>
0051 <item>exit</item>
0052 <item>fg</item>
0053 <item>fish</item>
0054 <item>fish_config</item>
0055 <item>fish_indent</item>
0056 <item>fish_key_reader</item>
0057 <item>fish_mode_prompt</item>
0058 <item>fish_opt</item>
0059 <item>fish_prompt</item>
0060 <item>fish_right_prompt</item>
0061 <item>fish_update_completions</item>
0062 <item>fish_vi_mode</item>
0063 <item>funced</item>
0064 <item>funcsave</item>
0065 <item>functions</item>
0066 <item>help</item>
0067 <item>history</item>
0068 <item>isatty</item>
0069 <item>jobs</item>
0070 <item>math</item>
0071 <item>nextd</item>
0072 <item>open</item>
0073 <item>prevd</item>
0074 <item>printf</item>
0075 <item>psub</item>
0076 <item>pushd</item>
0077 <item>random</item>
0078 <item>realpath</item>
0079 <item>return</item>
0080 <item>set_color</item>
0081 <item>source</item>
0082 <item>status</item>
0083 <item>suspend</item>
0084 <item>trap</item>
0085 <item>type</item>
0086 <item>ulimit</item>
0087 <item>umask</item>
0088 <item>vared</item>
0089 </list>
0090
0091 <list name="commandsnoargs">
0092 <item>break</item>
0093 <item>breakpoint</item>
0094 <item>continue</item>
0095 <item>dirh</item>
0096 <item>false</item>
0097 <item>popd</item>
0098 <item>prompt_pwd</item>
0099 <item>pwd</item>
0100 <item>true</item>
0101 </list>
0102
0103 <list name="commandsstay">
0104 <item>and</item>
0105 <item>not</item>
0106 <item>or</item>
0107 </list>
0108
0109 <list name="stringsubcommands">
0110 <item>escape</item>
0111 <item>join</item>
0112 <item>length</item>
0113 <item>lower</item>
0114 <item>match</item>
0115 <item>repeat</item>
0116 <item>replace</item>
0117 <item>split</item>
0118 <item>sub</item>
0119 <item>trim</item>
0120 <item>unescape</item>
0121 <item>upper</item>
0122 </list>
0123
0124 <list name="unixcommands">
0125 <include>unixcommands##Bash</include>
0126 <item>command</item>
0127 <item>kill</item>
0128 <item>test</item>
0129 </list>
0130
0131
0132
0133 <contexts>
0134 <context name="Start" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="Root">
0135 <DetectChar attribute="Error" context="DropRestOfLine" char=")"/>
0136 </context>
0137
0138 <context name="DropRestOfLine" attribute="Normal Text" lineEndContext="#pop">
0139 <DetectChar attribute="Comment" context="Comment" char="#"/>
0140 <RegExpr attribute="Normal Text" String="[^#]*" />
0141 </context>
0142
0143 <!-- Root starts at a new line (not continuation) -->
0144 <context name="Root" attribute="Normal Text" lineEndContext="#pop">
0145 <LineContinue attribute="Escape" />
0146 <DetectChar attribute="Comment" context="Comment" char="#"/>
0147 <DetectChar context="#pop" char=")" lookAhead="true" />
0148 <IncludeRules context="FindCommands" />
0149 </context>
0150
0151 <!--
0152 fish interprets closing parenthesis inside comments as end of command substitution, if the comment starts
0153 inside of a command substitution!
0154
0155 fish does not interpret them this way, when
0156 they are escaped by a \ or
0157 they are matched by an earlier opening parenthesis inside the same comment.
0158 This behaviour is replicated here.
0159
0160 Command substitutions may span several lines, so the closing parenthesis may be on a different line,
0161 than the opening one. In the interactive shell you need a continuation line for this, not so in scripts.
0162 Blocks of code with multiline command substitutions may be commented out. This should not lead to visual artifacts.
0163
0164 There is one case, where the following solution fails: a lonely closing ")", which is marked as an error.
0165 -->
0166 <context name="Comment" attribute="Comment" lineEndContext="#pop">
0167 <Detect2Chars attribute="Comment" char="\" char1="(" />
0168 <Detect2Chars attribute="Comment" char="\" char1=")" />
0169 <DetectChar context="CommentParenSub" char="(" />
0170 <DetectChar context="#pop" char=")" lookAhead="true" />
0171 <IncludeRules context="##Comments" />
0172 </context>
0173
0174 <context name="CommentParenSub" attribute="Comment" lineEndContext="BlockComment">
0175 <DetectChar attribute="Comment" context="#pop" char=")" />
0176 <IncludeRules context="Comment" />
0177 </context>
0178
0179 <context name="BlockComment" attribute="Comment" fallthroughContext="#pop#pop#pop" lineEndContext="#stay">
0180 <DetectChar attribute="Comment" context="#pop" char="#" firstNonSpace="true"/>
0181 </context>
0182
0183 <!-- FindCommands matches Fish and Unix commands -->
0184 <!-- order is important, factor out common rules did'nt work because of order of rules-->
0185 <context name="FindCommands" attribute="Command" lineEndContext="#stay">
0186 <DetectSpaces attribute="Normal Text" />
0187 <AnyChar attribute="Error" context="#pop!DropRestOfLine" String="(<>"/>
0188 <AnyChar attribute="Separator" String="&commandsep;" />
0189 <keyword attribute="Builtin" context="Arguments" String="commands" /> <!--simple commands first-->
0190 <keyword attribute="Builtin" context="ArgumentsNone" String="commandsnoargs" />
0191 <keyword attribute="Control Flow" String="commandsstay" />
0192 <Detect2Chars attribute="Builtin" context="Arguments" char="." char1=" " />
0193 <RegExpr attribute="CommandPath" context="CommandPart" String="&pathdetect;" />
0194 <IncludeRules context="FindSpecialCommands" /> <!--before unixcommands, because f test, but after path detection-->
0195 <keyword attribute="UnixCommand" context="Arguments" String="unixcommands"/>
0196 <RegExpr attribute="Command" context="CommandPart" String="&command;" />
0197 <DetectChar context="CommandPart" char=""" lookAhead="true"/>
0198 </context>
0199
0200 <context name="CommandPart" attribute="Command" lineEndContext="#pop">
0201 <LineContinue attribute="Escape" />
0202 <AnyChar context="#pop" String=")#" lookAhead="true"/>
0203 <AnyChar attribute="Separator" context="#pop" String="&commandsep;" />
0204 <AnyChar context="#pop!Arguments" String="&eocommand;" lookAhead="true"/>
0205 <RegExpr attribute="CommandPath" String="&pathpart;" />
0206 <keyword attribute="UnixCommand" String="unixcommands"/>
0207 <RegExpr attribute="Command" String="&command;" />
0208 <IncludeRules context="FindStrings" />
0209 <RegExpr attribute="Error" String="." />
0210 </context>
0211
0212 <context name="FindSpecialCommands" attribute="Builtin" lineEndContext="#stay">
0213 <WordDetect attribute="Builtin" String="command" context="command_builtin" />
0214 <WordDetect attribute="Builtin" String="builtin" context="command_builtin" />
0215 <WordDetect attribute="Builtin" String="eval" context="eval_exec" />
0216 <WordDetect attribute="Builtin" String="exec" context="eval_exec" />
0217 <WordDetect attribute="Builtin" String="set" context="set" />
0218 <WordDetect attribute="Builtin" String="string" context="string" />
0219 <WordDetect attribute="Builtin" String="read" context="read_vared" />
0220 <WordDetect attribute="Builtin" String="vared" context="read_vared" />
0221 <WordDetect attribute="Builtin" String="test" context="ArgumentsTest" />
0222 <Detect2Chars attribute="Builtin" char="[" char1="&tab;" context="ArgumentsTestBrack" />
0223 <Detect2Chars attribute="Builtin" char="[" char1=" " context="ArgumentsTestBrack" />
0224 <WordDetect attribute="Control Flow" String="begin" context="begin" beginRegion="begin" />
0225 <WordDetect attribute="Control Flow" String="for" context="for" beginRegion="for" />
0226 <WordDetect attribute="Control Flow" String="function" context="function" beginRegion="function" />
0227 <WordDetect attribute="Control Flow" String="if" context="if" beginRegion="if" />
0228 <WordDetect attribute="Control Flow" String="switch" context="switch" beginRegion="switch" />
0229 <WordDetect attribute="Control Flow" String="while" context="while" beginRegion="while" />
0230 </context>
0231
0232 <context name="command_builtin" attribute="Normal Text" lineEndContext="#pop">
0233 <LineContinue attribute="Escape" />
0234 <RegExpr attribute="Option" String="-&alnumdash;*" />
0235 <AnyChar attribute="Separator" context="#pop" String="&commandsep;" />
0236 <IncludeRules context="Root" />
0237 </context>
0238
0239 <context name="eval_exec" attribute="Normal Text" lineEndContext="#pop">
0240 <DetectChar context="#pop" char=")" lookAhead="true"/>
0241 <AnyChar attribute="Separator" context="#pop" String="&commandsep;" />
0242 <IncludeRules context="FindStrings" />
0243 <IncludeRules context="FindVarExpansion" />
0244 <IncludeRules context="FindSubstitutions" />
0245 <IncludeRules context="FindBraceExpansion" />
0246 <IncludeRules context="FindPaths" />
0247 <IncludeRules context="FindEscapes" />
0248 <IncludeRules context="Root" />
0249 </context>
0250
0251 <context name="set" attribute="Normal Text" lineEndContext="#pop">
0252 <LineContinue attribute="Escape" />
0253 <AnyChar attribute="Separator" context="#pop" String="&commandsep;" />
0254 <RegExpr attribute="Option" String="-&alnumdash;*" />
0255 <RegExpr attribute="Variable" String="&varname;" context="set_CheckSubscript" />
0256 <IncludeRules context="FindVarExpansion" />
0257 </context>
0258
0259 <!-- check set var[1] -->
0260 <context name="set_CheckSubscript" attribute="Normal Text" fallthroughContext="#pop!Arguments" lineEndContext="#pop#pop">
0261 <LineContinue attribute="Escape" context="set_CheckSubscript2"/>
0262 <DetectChar attribute="Index" context="set_Subscript" char="["/>
0263 </context>
0264 <!-- check set var\
0265 [1] -->
0266 <context name="set_CheckSubscript2" attribute="Normal Text" fallthroughContext="#pop#pop!Arguments" lineEndContext="#pop#pop#pop">
0267 <DetectChar attribute="Index" context="#pop!set_Subscript" char="["/>
0268 </context>
0269
0270 <context name="set_Subscript" attribute="Index" lineEndContext="#pop#pop#pop">
0271 <DetectChar attribute="Index" context="#pop#pop!Arguments" char="]" />
0272 <IncludeRules context="InSubscript" />
0273 </context>
0274
0275 <context name="string" attribute="Normal Text" lineEndContext="#pop">
0276 <LineContinue attribute="Escape" />
0277 <DetectSpaces attribute="Normal Text" />
0278 <keyword attribute="Builtin" context="#pop!Arguments" String="stringsubcommands" />
0279 <RegExpr attribute="Error" String="." />
0280 </context>
0281
0282 <context name="read_vared" attribute="Normal Text" lineEndContext="#pop">
0283 <LineContinue attribute="Escape" />
0284 <RegExpr attribute="Option" String="-&alnumdash;*" />
0285 <DetectChar attribute="Comment" context="Comment" char="#"/>
0286 <AnyChar attribute="Separator" context="#pop" String="&commandsep;" />
0287 <DetectChar context="#pop" char=")" lookAhead="true"/>
0288 <IncludeRules context="FindStrings" />
0289 <IncludeRules context="FindVarExpansion" />
0290 <IncludeRules context="FindSubstitutions" />
0291 <IncludeRules context="FindBraceExpansion" />
0292 <IncludeRules context="FindEscapes" />
0293 <RegExpr attribute="Variable" String="&varname;" />
0294 </context>
0295
0296 <context name="ArgumentsTestBrack" attribute="Normal Text" lineEndContext="#pop">
0297 <LineContinue attribute="Escape" />
0298 <Detect2Chars attribute="Builtin" char=" " char1="]" context="#pop!ArgumentsNonePre" />
0299 <AnyChar attribute="Error" context="#pop!DropRestOfLine" String="#&commandsep;&"/>
0300 <IncludeRules context="ArgumentsTest" />
0301 </context>
0302
0303 <context name="ArgumentsTest" attribute="Normal Text" lineEndContext="#pop">
0304 <LineContinue attribute="Escape" />
0305 <RegExpr attribute="Operator" context="DirectPath" String="-&testoptsfile; " />
0306 <RegExpr attribute="Operator" String="-&testoptsother; |!=?|=| -eq | -ne | -gt | -ge | -lt | -le "/>
0307 <AnyChar context="#pop" String="&commandsep;#" lookAhead="true"/>
0308 <IncludeRules context="FindArgumentsCommon" />
0309 </context>
0310
0311 <context name="begin" attribute="Normal Text" lineEndContext="beginbody">
0312 <DetectSpaces attribute="Normal Text" />
0313 <DetectChar attribute="Separator" context="beginbody" char=";" />
0314 <IncludeRules context="Root" />
0315 </context>
0316
0317 <context name="beginbody" attribute="Normal Text" lineEndContext="#stay">
0318 <LineContinue attribute="Escape" />
0319 <WordDetect attribute="Control Flow" String="end" context="#pop#pop" endRegion="begin" />
0320 <IncludeRules context="Root" />
0321 </context>
0322
0323 <context name="for" attribute="Normal Text" lineEndContext="#stay">
0324 <LineContinue attribute="Escape" />
0325 <DetectSpaces attribute="Normal Text" />
0326 <WordDetect attribute="Control Flow" String="in" context="forargs" />
0327 <RegExpr attribute="Variable" String="&varname;" />
0328 <IncludeRules context="FindVarExpansion" />
0329 <RegExpr attribute="Error" String="."/>
0330 </context>
0331
0332 <context name="forargs" attribute="Normal Text" lineEndContext="forbody">
0333 <DetectChar attribute="Separator" context="forbody" char=";" />
0334 <DetectChar attribute="Comment" context="Comment" char="#"/>
0335 <IncludeRules context="FindArgumentsCommon" />
0336 </context>
0337
0338 <context name="forbody" attribute="Normal Text" lineEndContext="#stay">
0339 <LineContinue attribute="Escape" />
0340 <WordDetect attribute="Control Flow" String="end" context="#pop#pop#pop" endRegion="for" />
0341 <IncludeRules context="Root" />
0342 </context>
0343
0344 <context name="function" attribute="Normal Text" lineEndContext="funcbody">
0345 <LineContinue attribute="Escape" />
0346 <DetectSpaces attribute="Normal Text" />
0347 <DetectChar attribute="Comment" context="func_comment" char="#"/>
0348 <DetectChar context="funcopts" char="-" lookAhead="true" />
0349 <DetectChar attribute="Separator" context="funcbody" char=";" />
0350 <RegExpr attribute="Command" String="&funcname;" />
0351 <IncludeRules context="FindVarExpansion" />
0352 <RegExpr attribute="Error" String="."/>
0353 </context>
0354
0355 <context name="func_comment" attribute="Comment" lineEndContext="#pop!funcbody">
0356 </context>
0357
0358 <context name="funcopts" attribute="Normal Text" lineEndContext="#pop!funcbody">
0359 <DetectChar attribute="Comment" context="#pop!func_comment" char="#"/>
0360 <RegExpr attribute="Option" String="(?:-d[&white;]*|--description=)(?=["'])" context="funcdesc" beginRegion="doc"/>
0361 <RegExpr attribute="Option" String="-&alnumdash;*" />
0362 <DetectChar attribute="Separator" context="#pop!funcbody" char=";" />
0363 <IncludeRules context="FindArgumentsCommon" />
0364 </context>
0365
0366 <context name="funcdesc" attribute="Function Doc" lineEndContext="#stay">
0367 <DetectChar context="DocstringSQ" char="'" />
0368 <DetectChar context="DocstringDQ" char=""" />
0369 </context>
0370
0371 <!-- StringSQ consumes anything till ' -->
0372 <context name="DocstringSQ" attribute="Function Doc" lineEndContext="#stay">
0373 <!--no line continuation here-->
0374 <Detect2Chars attribute="Escape" char="\" char1="'" />
0375 <Detect2Chars attribute="Escape" char="\" char1="\" />
0376 <DetectChar attribute="Function Doc" context="#pop#pop" char="'" endRegion="doc"/>
0377 </context>
0378
0379 <!-- StringDQ consumes anything till ", substitutes vars and expressions -->
0380 <context name="DocstringDQ" attribute="Function Doc" lineEndContext="#stay">
0381 <LineContinue attribute="Escape" />
0382 <Detect2Chars attribute="Escape" char="\" char1=""" />
0383 <Detect2Chars attribute="Escape" char="\" char1="$" />
0384 <Detect2Chars attribute="Escape" char="\" char1="\" />
0385 <IncludeRules context="FindVarExpansion" />
0386 <DetectChar attribute="Function Doc" context="#pop#pop" char=""" endRegion="doc"/>
0387 </context>
0388
0389 <context name="funcbody" attribute="Normal Text" lineEndContext="#stay">
0390 <LineContinue attribute="Escape" />
0391 <WordDetect attribute="Control Flow" String="end" context="#pop#pop" endRegion="function" />
0392 <IncludeRules context="Root" />
0393 </context>
0394
0395 <context name="if" attribute="Normal Text" lineEndContext="#stay">
0396 <LineContinue attribute="Escape"/>
0397 <WordDetect attribute="Control Flow" String="else" context="else" endRegion="if" beginRegion="if"/>
0398 <WordDetect attribute="Control Flow" String="end" context="#pop" endRegion="if"/>
0399 <IncludeRules context="Root" />
0400 </context>
0401
0402 <context name="else" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop">
0403 <DetectSpaces attribute="Normal Text" context="#stay"/>
0404 <LineContinue attribute="Escape" context="#stay"/>
0405 <WordDetect attribute="Control Flow" String="if" context="#pop"/>
0406 </context>
0407
0408 <context name="switch" attribute="Normal Text" lineEndContext="switchbody">
0409 <DetectChar attribute="Separator" context="switchbody" char=";" />
0410 <DetectChar attribute="Comment" context="Comment" char="#"/>
0411 <IncludeRules context="FindArgumentsCommon" />
0412 </context>
0413
0414 <context name="switchbody" attribute="Normal Text" lineEndContext="#stay">
0415 <LineContinue attribute="Escape" />
0416 <WordDetect attribute="Control Flow" String="case" context="case" beginRegion="case" />
0417 <WordDetect attribute="Control Flow" String="end" context="#pop#pop" endRegion="switch"/>
0418 <IncludeRules context="Root" />
0419 </context>
0420
0421 <context name="case" attribute="Normal Text" lineEndContext="casebody">
0422 <DetectChar attribute="Separator" context="casebody" char=";" />
0423 <DetectChar attribute="Comment" context="Comment" char="#"/>
0424 <IncludeRules context="FindArgumentsCommon" />
0425 </context>
0426
0427 <context name="casebody" attribute="Normal Text" lineEndContext="#stay">
0428 <LineContinue attribute="Escape" />
0429 <WordDetect attribute="Control Flow" String="case" context="#pop" endRegion="case" beginRegion="case" />
0430 <WordDetect attribute="Control Flow" String="end" context="#pop#pop" endRegion="case" lookAhead="1"/>
0431 <IncludeRules context="Root" />
0432 </context>
0433
0434 <context name="while" attribute="Normal Text" lineEndContext="#stay">
0435 <LineContinue attribute="Escape" />
0436 <WordDetect attribute="Control Flow" String="end" context="#pop" endRegion="while"/>
0437 <IncludeRules context="Root" />
0438 </context>
0439
0440 <!--Argument Rules match the items after a command
0441 this one is a collection with the common part for inclusion-->
0442 <context name="Arguments" attribute="Normal Text" lineEndContext="#pop">
0443 <AnyChar context="#pop" String="&commandsep;)" lookAhead="true"/>
0444 <DetectChar attribute="Comment" context="Comment" char="#"/>
0445 <IncludeRules context="FindArgumentsCommon" />
0446 </context>
0447
0448 <context name="FindArgumentsCommon" attribute="Normal Text" lineEndContext="#stay">
0449 <LineContinue context="ArgumentPotentialMultiLineComment" lookAhead="1"/>
0450 <DetectSpaces attribute="Normal Text" />
0451 <RegExpr attribute="Option" String="-&alnumdash;*" />
0452 <RegExpr attribute="Redirection" context="Redirect" String="[0-9]*(?:>{1,2}|<|\^{1,2})" />
0453 <DetectChar attribute="Operator" char="="/>
0454 <IncludeRules context="FindStrings" />
0455 <IncludeRules context="FindVarExpansion" />
0456 <IncludeRules context="FindSubstitutions" />
0457 <IncludeRules context="FindBraceExpansion" />
0458 <IncludeRules context="FindProcessExpansion" />
0459 <IncludeRules context="FindPaths" />
0460 <IncludeRules context="FindEscapes" />
0461 <RegExpr attribute="Normal Text" String="[^&separator;&special;]*" /> <!--unknown token-->
0462 </context>
0463
0464 <!-- check \ preceded by a space -->
0465 <context name="ArgumentPotentialMultiLineComment" attribute="Comment">
0466 <RegExpr attribute="Escape" context="ArgumentComment" String="(?<=\s)\\$" />
0467 <LineContinue attribute="Escape" context="#pop"/>
0468 </context>
0469
0470 <context name="ArgumentComment" attribute="Comment" fallthroughContext="#pop#pop">
0471 <DetectSpaces attribute="Normal Text"/>
0472 <DetectChar context="Comment" char="#"/>
0473 </context>
0474
0475 <context name="ArgumentsNonePre" attribute="Normal Text" lineEndContext="#pop">
0476 <LineContinue attribute="Escape" />
0477 <DetectSpaces attribute="Normal Text" context="#pop!ArgumentsNone" />
0478 <AnyChar context="#pop" String="&commandsep;" lookAhead="true"/> <!--consumed on the "Find"-Level-->
0479 <RegExpr attribute="Error" String="."/>
0480 </context>
0481
0482 <context name="ArgumentsNone" attribute="Normal Text" lineEndContext="#pop">
0483 <LineContinue attribute="Escape" />
0484 <DetectSpaces attribute="Normal Text" />
0485 <DetectChar attribute="Comment" context="Comment" char="#"/>
0486 <RegExpr attribute="Redirection" context="Redirect" String="[0-9]*(?:>{1,2}|<|\^{1,2})" />
0487 <AnyChar context="#pop" String="&commandsep;)" lookAhead="true"/> <!--consumed on the "Find"-Level-->
0488 <RegExpr attribute="Error" String="[^&commandsep;#]*"/>
0489 </context>
0490
0491 <context name="TokEnd" attribute="Normal Text" lineEndContext="#pop">
0492 <LineContinue attribute="Escape" />
0493 <DetectSpaces attribute="Normal Text" context="#pop"/>
0494 <AnyChar context="#pop" String="&commandsep;" lookAhead="true"/> <!--consumed on the "Find"-Level-->
0495 <RegExpr attribute="Error" String="." context="#pop"/>
0496 </context>
0497
0498 <context name="Redirect" attribute="Redirection" fallthroughContext="#pop!DirectPath" lineEndContext="#stay">
0499 <LineContinue attribute="Escape" />
0500 <DetectChar attribute="Redirection" context="#pop!DirectPath" char="?"/>
0501 <DetectChar attribute="Redirection" context="#pop#pop" char="|"/>
0502 <RegExpr attribute="Redirection" context="#pop!TokEnd" String="&(?:[0-9]+|-)" />
0503 </context>
0504
0505 <context name="InSubscript" attribute="Index" lineEndContext="#pop">
0506 <Detect2Chars char="." char1="." />
0507 <LineContinue attribute="Escape" />
0508 <RegExpr attribute="Index" String=" *-?\d+" />
0509 <IncludeRules context="FindVarExpansion" />
0510 <IncludeRules context="FindSubstitutions" />
0511 <DetectSpaces attribute="Normal Text" />
0512 <RegExpr attribute="Error" String="[^\]]" />
0513 </context>
0514
0515 <context name="Subscript" attribute="Index" lineEndContext="#pop">
0516 <DetectChar attribute="Index" context="#pop" char="]" />
0517 <IncludeRules context="InSubscript" />
0518 </context>
0519
0520 <!-- FindStrings looks for single and double quoted strings -->
0521 <context name="FindStrings" attribute="Normal Text" lineEndContext="#stay">
0522 <DetectChar context="StringSQ" char="'" />
0523 <DetectChar context="StringDQ" char=""" />
0524 </context>
0525
0526 <!-- StringSQ consumes anything till ' -->
0527 <context name="StringSQ" attribute="String SingleQ" lineEndContext="#stay">
0528 <!--no line continuation here-->
0529 <Detect2Chars attribute="Escape" char="\" char1="'" />
0530 <Detect2Chars attribute="Escape" char="\" char1="\" />
0531 <DetectChar attribute="String SingleQ" context="#pop" char="'" />
0532 </context>
0533
0534 <!-- StringDQ consumes anything till ", substitutes vars and expressions -->
0535 <context name="StringDQ" attribute="String DoubleQ" lineEndContext="#stay">
0536 <LineContinue attribute="Escape" />
0537 <Detect2Chars attribute="Escape" char="\" char1=""" />
0538 <Detect2Chars attribute="Escape" char="\" char1="$" />
0539 <Detect2Chars attribute="Escape" char="\" char1="\" />
0540 <IncludeRules context="FindVarExpansion" />
0541 <DetectChar attribute="String DoubleQ" context="#pop" char=""" />
0542 </context>
0543
0544 <!-- FindVarExpansion goes after anything starting with $ and and their escapes -->
0545 <context name="FindVarExpansion" attribute="Normal Text" lineEndContext="#stay">
0546 <RegExpr attribute="Variable" context="CheckSubscript" String="\$+&varname;" />
0547 </context>
0548
0549 <!-- Subscript consumes anything till ], marks as Variable -->
0550 <context name="CheckSubscript" attribute="Index" lineEndContext="#pop" fallthroughContext="#pop">
0551 <LineContinue attribute="Escape" />
0552 <DetectChar attribute="Index" context="Subscript" char="["/>
0553 </context>
0554
0555 <!-- Command Substitution -->
0556 <context name="FindSubstitutions" attribute="Normal Text" lineEndContext="#stay">
0557 <DetectChar attribute="Keychar" context="CommandSubstitution" char="(" />
0558 </context>
0559
0560 <context name="CommandSubstitution" attribute="Normal Text" fallthroughContext="Root" lineEndContext="#stay">
0561 <LineContinue attribute="Escape" />
0562 <DetectChar attribute="Keychar" context="CommandSubstitutionCheckSubscript" char=")" />
0563 </context>
0564
0565 <!-- check (...)[1] -->
0566 <context name="CommandSubstitutionCheckSubscript" attribute="Normal Text" fallthroughContext="#pop#pop" lineEndContext="#pop#pop">
0567 <LineContinue attribute="Escape" context="CommandSubstitutionCheckSubscript2"/>
0568 <DetectChar attribute="Index" context="CommandSubstitutionSubscript" char="["/>
0569 </context>
0570 <!-- check (...)\
0571 [1] -->
0572 <context name="CommandSubstitutionCheckSubscript2" attribute="Normal Text" fallthroughContext="#pop#pop#pop" lineEndContext="#pop#pop#pop">
0573 <DetectChar attribute="Index" context="#pop!CommandSubstitutionSubscript" char="["/>
0574 </context>
0575
0576 <context name="CommandSubstitutionSubscript" attribute="Index" lineEndContext="#pop#pop#pop">
0577 <DetectChar attribute="Index" context="#pop#pop#pop" char="]" />
0578 <IncludeRules context="InSubscript" />
0579 </context>
0580
0581 <!-- Brace Expansion consumes anything till } -->
0582 <context name="FindBraceExpansion" attribute="Normal Text" lineEndContext="#stay">
0583 <DetectChar attribute="Keychar" context="BraceList" char="{" />
0584 <DetectChar attribute="Error" char="}" />
0585 </context>
0586
0587 <context name="BraceList" attribute="Normal Text" lineEndContext="#pop">
0588 <LineContinue attribute="Escape" />
0589 <DetectChar attribute="Keychar" context="#pop" char="}" />
0590 <DetectChar attribute="Separator" char="," />
0591 <RegExpr attribute="Normal Text" String="&braceelement;*"/>
0592 <IncludeRules context="FindStrings" />
0593 <IncludeRules context="FindVarExpansion" />
0594 <IncludeRules context="FindSubstitutions" />
0595 <IncludeRules context="FindBraceExpansion" />
0596 <IncludeRules context="FindPaths" />
0597 <IncludeRules context="FindEscapes" />
0598 <RegExpr attribute="Error" String="."/>
0599 </context>
0600
0601 <!-- Process Expansion -->
0602 <context name="FindProcessExpansion" attribute="Normal Text" lineEndContext="#pop">
0603 <DetectChar attribute="Keychar" context="ProcessArg" char="%" />
0604 </context>
0605
0606 <context name="ProcessArg" attribute="Process" lineEndContext="#pop">
0607 <LineContinue attribute="Escape" />
0608 <AnyChar context="#pop" String="&white;" />
0609 <AnyChar context="#pop" String="&separator;" lookAhead="true" />
0610 <DetectChar attribute="Comment" context="Comment" char="#"/>
0611 <IncludeRules context="FindStrings" />
0612 <IncludeRules context="FindVarExpansion" />
0613 <IncludeRules context="FindSubstitutions" />
0614 <IncludeRules context="FindBraceExpansion" />
0615 <IncludeRules context="FindEscapes" />
0616 </context>
0617
0618 <!-- FindPaths for parts which might be a path. Uses the matching of a / as heuristic -->
0619 <!-- Might be fooled with quotes -->
0620 <context name="FindPaths" attribute="Path" lineEndContext="#stay">
0621 <RegExpr context="DirectPath" String="&pathdetect;" lookAhead="true" minimal="1"/>
0622 </context>
0623
0624 <!-- DirectPath is used at places where the next part is definitely a path -->
0625 <context name="DirectPath" attribute="Path" lineEndContext="#pop" fallthroughContext="#pop!PathHead" >
0626 <LineContinue attribute="Escape" />
0627 <DetectSpaces attribute="Normal Text" />
0628 <AnyChar attribute="Error" context="#pop" String="#&commandsep;<>^" />
0629 </context>
0630
0631 <context name="PathHead" attribute="Path" lineEndContext="#pop" fallthroughContext="#pop!Path" >
0632 <LineContinue attribute="Escape" />
0633 <RegExpr attribute="HomeDir" context="#pop!Path" String="&homedir;" />
0634 </context>
0635
0636 <context name="Path" attribute="Path" lineEndContext="#pop">
0637 <LineContinue attribute="Escape" />
0638 <DetectSpaces context="#pop" lookAhead="true" />
0639 <AnyChar context="#pop" String="#&commandsep;<>^)" lookAhead="true" />
0640 <AnyChar attribute="Glob" String="*?" />
0641 <DetectChar attribute="Path" char="/" />
0642 <DetectChar attribute="Keychar" context="PathBrace" char="{" />
0643 <DetectChar attribute="Error" context="#pop" char="}" />
0644 <IncludeRules context="FindStrings" />
0645 <IncludeRules context="FindVarExpansion" />
0646 <IncludeRules context="FindSubstitutions" />
0647 <IncludeRules context="FindEscapes" />
0648 <RegExpr attribute="Path" String="[^$\*\?\\{}&separator;/]*" /> <!--consume everything until next special-->
0649 </context>
0650
0651 <context name="PathBrace" attribute="Path" lineEndContext="#pop">
0652 <LineContinue attribute="Escape" />
0653 <DetectChar attribute="Keychar" context="#pop" char="}" />
0654 <DetectChar attribute="Separator" char="," />
0655 <AnyChar attribute="Error" String=" #&commandsep;<>^)" />
0656 <AnyChar attribute="Glob" String="*?" />
0657 <DetectChar attribute="Path" char="/" />
0658 <DetectChar attribute="Keychar" context="PathBrace" char="{" />
0659 <IncludeRules context="FindStrings" />
0660 <IncludeRules context="FindVarExpansion" />
0661 <IncludeRules context="FindSubstitutions" />
0662 <IncludeRules context="FindEscapes" />
0663 <RegExpr attribute="Path" String="[^$\*\?\\,{}&separator;/]*" />
0664 </context>
0665
0666 <!-- FindEscapes contains various rules to mark different shell input -->
0667 <context name="FindEscapes" attribute="Normal Text" lineEndContext="#stay">
0668 <RegExpr attribute="Escape" String="\\(?:&escapechars;|[0-7]{1,3}|[xX][A-Fa-f0-9]{1,2}|u[A-Fa-f0-9]{1,4}|U[A-Fa-f0-9]{1,8}|c.)" />
0669 </context>
0670
0671 </contexts>
0672
0673 <itemDatas>
0674 <itemData name="Normal Text" defStyleNum="dsNormal" />
0675 <itemData name="Path" defStyleNum="dsNormal" />
0676 <itemData name="Option" defStyleNum="dsNormal" />
0677 <itemData name="Escape" defStyleNum="dsKeyword" />
0678 <itemData name="Separator" defStyleNum="dsKeyword" />
0679 <itemData name="Glob" defStyleNum="dsKeyword" />
0680 <itemData name="HomeDir" defStyleNum="dsKeyword" />
0681 <itemData name="Keychar" defStyleNum="dsSpecialChar" />
0682 <itemData name="Command" defStyleNum="dsFunction" />
0683 <itemData name="UnixCommand" defStyleNum="dsFunction" />
0684 <itemData name="CommandPath" defStyleNum="dsExtension" />
0685 <itemData name="Variable" defStyleNum="dsVariable" />
0686 <itemData name="Control Flow" defStyleNum="dsControlFlow" />
0687 <itemData name="Operator" defStyleNum="dsOperator" />
0688 <itemData name="Redirection" defStyleNum="dsOperator" />
0689 <itemData name="Builtin" defStyleNum="dsBuiltIn" />
0690 <itemData name="Index" defStyleNum="dsAttribute" />
0691
0692 <itemData name="String SingleQ" defStyleNum="dsString" />
0693 <itemData name="String DoubleQ" defStyleNum="dsString" />
0694 <itemData name="Process" defStyleNum="dsImport" />
0695
0696
0697 <itemData name="Comment" defStyleNum="dsComment" />
0698 <itemData name="Function Doc" defStyleNum="dsDocumentation" />
0699
0700 <itemData name="Error" defStyleNum="dsError" />
0701 </itemDatas>
0702 </highlighting>
0703 <general>
0704 <!-- no / as weakDeliminator, otherwwise in /usr/bin/ls ls is not recognized as UnixCommand -->
0705 <keywords casesensitive="1" weakDeliminator="\+,-:=!.@#%^_`~" wordWrapDeliminator="&separator;"/>
0706 <comments>
0707 <comment name="singleLine" start="#"/>
0708 </comments>
0709 </general>
0710 </language>