summaryrefslogtreecommitdiffstats
path: root/kate/data/bash.xml
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-02 09:20:27 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-02 09:20:27 +0000
commitd7b9791584eda0f022813fd2b2df50f59eba29c5 (patch)
tree395d2d48909ce6f9e002106d1638610f7a7c8321 /kate/data/bash.xml
parent84bbc54a086fc6894b247488bf62bdff04dd55fa (diff)
downloadtdelibs-d7b9791584eda0f022813fd2b2df50f59eba29c5.tar.gz
tdelibs-d7b9791584eda0f022813fd2b2df50f59eba29c5.zip
Added remaining missing Kate xml files
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1068844 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kate/data/bash.xml')
-rw-r--r--kate/data/bash.xml511
1 files changed, 284 insertions, 227 deletions
diff --git a/kate/data/bash.xml b/kate/data/bash.xml
index 7fe38d3a4..cbb0f7643 100644
--- a/kate/data/bash.xml
+++ b/kate/data/bash.xml
@@ -1,15 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
- <!ENTITY funcname "[A-Za-z_:][A-Za-z0-9_:#&#37;@-]*">
- <!ENTITY varname "[A-Za-z_][A-Za-z0-9_]*">
- <!ENTITY word "[^|&amp;;()&lt;&gt;\s]+"> <!-- see man bash -->
- <!ENTITY eos "(?=($|\s))"> <!-- eol or space following -->
- <!ENTITY noword "(?![\w$+-])"> <!-- no word, $, + or - following -->
+ <!ENTITY funcname "[A-Za-z_:][A-Za-z0-9_:#&#37;@-]*">
+ <!ENTITY varname "[A-Za-z_][A-Za-z0-9_]*">
+ <!ENTITY word "[^|&amp;;()&lt;&gt;\s]+"> <!-- see man bash -->
+ <!ENTITY eos "(?=($|\s))"> <!-- eol or space following -->
+ <!ENTITY noword "(?![\w$+-])"> <!-- no word, $, + or - following -->
+ <!ENTITY pathpart "([\w_@.&#37;*?+-]|\\ )"> <!-- valid character in a file name -->
]>
-<language name="Bash" version="2.06" kateversion="2.4" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
+<language name="Bash" version="2.12" kateversion="2.4" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;.bashrc;.bash_profile;.bash_login;.profile" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
-<!-- (c) 2004 by Wilbert Berendsen, wilbert@kde.nl
+<!-- (c) 2004 by Wilbert Berendsen (wilbert@kde.nl)
+ Changes by Matthew Woehlke (mw_triad@users.sourceforge.net)
+ Changes by Sebastian Pipping (webmaster@hartwork.org)
Released under the LGPL, part of kdelibs/kate -->
<highlighting>
@@ -21,7 +24,6 @@
<item> select </item>
<item> until </item>
<item> while </item>
- <item> . </item>
<item> elif </item>
<item> then </item>
<item> set </item>
@@ -29,7 +31,6 @@
<list name="builtins">
<item> : </item>
- <item> . </item>
<item> source </item>
<item> alias </item>
<item> bg </item>
@@ -37,6 +38,7 @@
<item> break </item>
<item> builtin </item>
<item> cd </item>
+ <item> caller </item>
<item> command </item>
<item> compgen </item>
<item> complete </item>
@@ -68,6 +70,7 @@
<item> shopt </item>
<item> suspend </item>
<item> test </item>
+ <item> time </item>
<item> times </item>
<item> trap </item>
<item> type </item>
@@ -76,7 +79,7 @@
<item> unalias </item>
<item> wait </item>
</list>
-
+
<list name="builtins_var">
<item> export </item>
<item> unset </item>
@@ -86,7 +89,7 @@
<item> read </item>
<item> readonly </item>
</list>
-
+
<list name="unixcommands">
<!-- /bin -->
<item> arch </item>
@@ -132,6 +135,7 @@
<item> getkeycodes </item>
<item> gocr </item>
<item> grep </item>
+ <item> groff </item>
<item> groups </item>
<item> gunzip </item>
<item> gzexe </item>
@@ -165,6 +169,7 @@
<item> nano </item>
<item> netstat </item>
<item> nisdomainname </item>
+ <item> nroff </item>
<item> openvt </item>
<item> pgawk </item>
<item> pidof </item>
@@ -198,6 +203,7 @@
<item> tar </item>
<item> tempfile </item>
<item> touch </item>
+ <item> troff </item>
<item> true </item>
<item> umount </item>
<item> uname </item>
@@ -414,7 +420,7 @@
<item> yes </item>
<item> zip </item>
<item> zsoelim </item>
-
+
<!-- others -->
<item> dcop </item>
<item> kdialog </item>
@@ -424,317 +430,366 @@
<item> xset </item>
</list>
-
+
<contexts>
<context attribute="Normal Text" lineEndContext="#stay" name="Start">
- <IncludeRules context="FindAll" />
+ <IncludeRules context="FindAll" />
</context>
<!-- ====== The following rulessets are meant to be included ======== -->
<!-- FindAll tries to interpret everything -->
<context attribute="Normal Text" lineEndContext="#stay" name="FindAll">
- <IncludeRules context="FindComments" />
- <IncludeRules context="FindCommands" />
- <IncludeRules context="FindStrings" />
- <IncludeRules context="FindSubstitutions" />
- <IncludeRules context="FindOthers" />
+ <IncludeRules context="FindComments" />
+ <IncludeRules context="FindCommands" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindSubstitutions" />
+ <IncludeRules context="FindOthers" />
</context>
-
+
<!-- FindMost tries to interpret anything except commands -->
<context attribute="Normal Text" lineEndContext="#stay" name="FindMost">
- <IncludeRules context="FindComments" />
- <IncludeRules context="FindStrings" />
- <IncludeRules context="FindSubstitutions" />
- <IncludeRules context="FindOthers" />
+ <IncludeRules context="FindComments" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindSubstitutions" />
+ <IncludeRules context="FindOthers" />
</context>
<!-- FindComments consumes shell comments till EOL -->
<context attribute="Normal Text" lineEndContext="#pop" name="FindComments">
- <DetectChar attribute="Comment" context="Comment" char="#" firstNonSpace="true"/>
- <RegExpr attribute="Normal Text" context="Comment" String="[\s;](?=#)" />
+ <DetectChar attribute="Comment" context="Comment" char="#" firstNonSpace="true"/>
+ <RegExpr attribute="Normal Text" context="Comment" String="[\s;](?=#)" />
</context>
<context attribute="Comment" lineEndContext="#pop" name="Comment">
- <IncludeRules context="##Alerts" />
+ <IncludeRules context="##Alerts" />
</context>
-
+
<!-- FindCommentsParen consumes shell comments till EOL or a closing parenthese -->
<context attribute="Normal Text" lineEndContext="#pop" name="FindCommentsParen">
- <DetectChar attribute="Comment" context="CommentParen" char="#" firstNonSpace="true"/>
- <RegExpr attribute="Normal Text" context="CommentParen" String="[\s;](?=#)" />
+ <DetectChar attribute="Comment" context="CommentParen" char="#" firstNonSpace="true"/>
+ <RegExpr attribute="Normal Text" context="CommentParen" String="[\s;](?=#)" />
</context>
<context attribute="Comment" lineEndContext="#pop" name="CommentParen">
- <RegExpr attribute="Comment" context="#pop" String="[^)](?=\))" />
- <IncludeRules context="##Alerts" />
+ <RegExpr attribute="Comment" context="#pop" String="[^)](?=\))" />
+ <IncludeRules context="##Alerts" />
</context>
-
+
<!-- FindCommentsBackq consumes shell comments till EOL or a backquote -->
<context attribute="Normal Text" lineEndContext="#pop" name="FindCommentsBackq">
- <DetectChar attribute="Comment" context="CommentBackq" char="#" firstNonSpace="true"/>
- <RegExpr attribute="Normal Text" context="CommentBackq" String="[\s;](?=#)" />
+ <DetectChar attribute="Comment" context="CommentBackq" char="#" firstNonSpace="true"/>
+ <RegExpr attribute="Normal Text" context="CommentBackq" String="[\s;](?=#)" />
</context>
<context attribute="Comment" lineEndContext="#pop" name="CommentBackq">
- <RegExpr attribute="Comment" context="#pop" String="[^`](?=`)" />
- <IncludeRules context="##Alerts" />
+ <RegExpr attribute="Comment" context="#pop" String="[^`](?=`)" />
+ <IncludeRules context="##Alerts" />
</context>
-
-
+
+
<!-- FindCommands matches many items that can be expected outside strings, substitutions etc. -->
<context attribute="Normal Text" lineEndContext="#stay" name="FindCommands">
- <!-- start expression in double parentheses -->
- <Detect2Chars attribute="Keyword" context="ExprDblParen" char="(" char1="(" beginRegion="expression" />
- <!-- start expression in double brackets -->
- <RegExpr attribute="Keyword" context="ExprDblBracket" String="\[\[&eos;" beginRegion="expression" column="0"/>
- <RegExpr attribute="Keyword" context="ExprDblBracket" String="\s\[\[&eos;" beginRegion="expression" />
- <!-- start expression in single brackets -->
- <RegExpr attribute="Builtin" context="ExprBracket" String="\[&eos;" beginRegion="expression" column="0"/>
- <RegExpr attribute="Builtin" context="ExprBracket" String="\s\[&eos;" beginRegion="expression" />
- <!-- start a group command with { -->
- <RegExpr attribute="Keyword" context="Group" String="\{&eos;" beginRegion="group" />
- <!-- start a subshell -->
- <DetectChar attribute="Keyword" context="SubShell" char="(" beginRegion="subshell" />
- <!-- match do and if blocks -->
- <RegExpr attribute="Keyword" context="#stay" String="\bdo&noword;" beginRegion="do" />
- <RegExpr attribute="Keyword" context="#stay" String="\bdone&noword;" endRegion="do" />
- <RegExpr attribute="Keyword" context="#stay" String="\bif&noword;" beginRegion="if" />
- <RegExpr attribute="Keyword" context="#stay" String="\bfi&noword;" endRegion="if" />
- <!-- handle case as a special case -->
- <RegExpr attribute="Keyword" context="Case" String="\bcase&noword;" beginRegion="case" />
- <!-- handle command line options -->
- <RegExpr attribute="Option" context="#stay" String="-[A-Za-z0-9]+" />
- <RegExpr attribute="Option" context="#stay" String="--[a-z][A-Za-z0-9_-]*" />
- <!-- handle variable assignments -->
- <RegExpr attribute="Variable" context="Assign" String="\b&varname;\+?=" />
- <RegExpr attribute="Variable" context="AssignSubscr" String="\b&varname;(?=\[[^]]+\]=)" />
- <!-- handle functions with function keyword before keywords -->
- <StringDetect attribute="Function" context="#stay" String=":()" />
- <RegExpr attribute="Keyword" context="FunctionDef" String="\bfunction\b" />
- <!-- handle keywords -->
- <keyword attribute="Keyword" context="#stay" String="keywords" />
- <keyword attribute="Builtin" context="#stay" String="builtins" />
+ <!-- start expression in double parentheses -->
+ <Detect2Chars attribute="Keyword" context="ExprDblParen" char="(" char1="(" beginRegion="expression" />
+ <!-- start expression in double brackets -->
+ <RegExpr attribute="Keyword" context="ExprDblBracket" String="\[\[&eos;" beginRegion="expression" column="0"/>
+ <RegExpr attribute="Keyword" context="ExprDblBracket" String="\s\[\[&eos;" beginRegion="expression" />
+ <!-- start expression in single brackets -->
+ <RegExpr attribute="Builtin" context="ExprBracket" String="\[&eos;" beginRegion="expression" column="0"/>
+ <RegExpr attribute="Builtin" context="ExprBracket" String="\s\[&eos;" beginRegion="expression" />
+ <!-- start a group command with { -->
+ <RegExpr attribute="Keyword" context="Group" String="\{&eos;" beginRegion="group" />
+ <!-- start a subshell -->
+ <DetectChar attribute="Keyword" context="SubShell" char="(" beginRegion="subshell" />
+ <!-- match do and if blocks -->
+ <RegExpr attribute="Keyword" context="#stay" String="\bdo&noword;" beginRegion="do" />
+ <RegExpr attribute="Keyword" context="#stay" String="\bdone&noword;" endRegion="do" />
+ <RegExpr attribute="Keyword" context="#stay" String="\bif&noword;" beginRegion="if" />
+ <RegExpr attribute="Keyword" context="#stay" String="\bfi&noword;" endRegion="if" />
+ <!-- handle case as a special case -->
+ <RegExpr attribute="Keyword" context="Case" String="\bcase&noword;" beginRegion="case" />
+ <!-- handle command line options -->
+ <RegExpr attribute="Option" context="#stay" String="-[A-Za-z0-9][A-Za-z0-9_]*" />
+ <RegExpr attribute="Option" context="#stay" String="--[a-z][A-Za-z0-9_-]*" />
+ <!-- handle variable assignments -->
+ <RegExpr attribute="Variable" context="Assign" String="\b&varname;\+?=" />
+ <RegExpr attribute="Variable" context="AssignSubscr" String="\b&varname;(?=\[.+\]\+?=)" />
+ <!-- handle functions with function keyword before keywords -->
+ <StringDetect attribute="Function" context="#stay" String=":()" />
+ <RegExpr attribute="Keyword" context="FunctionDef" String="\bfunction\b" />
+ <!-- handle keywords -->
+ <keyword attribute="Keyword" context="#stay" String="keywords" />
+ <RegExpr attribute="Builtin" context="#stay" String="\.(?=\s)" />
+ <keyword attribute="Builtin" context="#stay" String="builtins" />
<keyword attribute="Command" context="#stay" String="unixcommands" />
- <!-- handle commands that have variable names as argument -->
- <keyword attribute="Builtin" context="VarName" String="builtins_var" />
+ <!-- handle commands that have variable names as argument -->
+ <keyword attribute="Builtin" context="VarName" String="builtins_var" />
<!-- handle here-string -->
- <StringDetect attribute="Redirection" context="#stay" String="&lt;&lt;&lt;" />
- <!-- handle here document -->
- <StringDetect attribute="Redirection" context="HereDoc" String="&lt;&lt;" lookAhead="true" />
+ <RegExpr attribute="Redirection" context="#stay" String="\d*&lt;&lt;&lt;" />
+ <!-- handle here document -->
+ <StringDetect attribute="Redirection" context="HereDoc" String="&lt;&lt;" lookAhead="true" />
<!-- handle process subst -->
<RegExpr attribute="Redirection" context="ProcessSubst" String="[&lt;&gt;]\(" />
<!-- handle redirection -->
<RegExpr attribute="Redirection" context="#stay" String="([0-9]*(&gt;{1,2}|&lt;)(&amp;[0-9]+-?)?|&amp;&gt;|&gt;&amp;|[0-9]*&lt;&gt;)" />
- <!-- handle &, &&, | and || -->
- <RegExpr attribute="Control" context="#stay" String="([|&amp;])\1?" />
- <!-- mark function definitions without function keyword -->
+ <!-- handle &, &&, | and || -->
+ <RegExpr attribute="Control" context="#stay" String="([|&amp;])\1?" />
+ <!-- mark function definitions without function keyword -->
<RegExpr attribute="Function" context="#stay" String="&funcname;\s*\(\)" />
</context>
<!-- FindOthers contains various rules to mark different shell input -->
<context attribute="Normal Text" lineEndContext="#stay" name="FindOthers">
- <RegExpr attribute="Escape" context="#stay" String="\\[][;&quot;\\'$`{}()|&amp;&lt;&gt;* ]" />
- <RegExpr attribute="Keyword" context="#stay" String="\\$" />
- <RegExpr attribute="Escape" context="#stay" String="\{(?!(\s|$))\S*\}" />
- <RegExpr attribute="Path" context="#stay" String="\.?/[\w_@.+-]+(?=([\s/):]|$))" />
- <!-- TODO: shell globs -->
+ <RegExpr attribute="Escape" context="#stay" String="\\[][;\\$`{}()|&amp;&lt;&gt;* ]" />
+ <RegExpr attribute="Keyword" context="#stay" String="\\$" />
+ <RegExpr attribute="Escape" context="#stay" String="\{(?!(\s|$))\S*\}" />
+ <RegExpr attribute="Path" context="#stay" String="&pathpart;*(?=/)" />
+ <RegExpr attribute="Path" context="#stay" String="~\w*" />
+ <RegExpr attribute="Path" context="#stay" String="/&pathpart;*(?=([\s/):;$`'&quot;]|$))" />
+ <!-- TODO: shell globs beside * and ? (in Path's) -->
</context>
-
+
<!-- FindStrings looks for single and double quoted strings, also with $-prefix -->
<context attribute="Normal Text" lineEndContext="#stay" name="FindStrings">
- <DetectChar attribute="String SingleQ" context="StringSQ" char="'" />
- <DetectChar attribute="String DoubleQ" context="StringDQ" char="&quot;" />
- <Detect2Chars attribute="String SingleQ" context="StringEsc" char="$" char1="'" />
- <Detect2Chars attribute="String Transl." context="StringDQ" char="$" char1="&quot;" />
+ <Detect2Chars attribute="Escape" context="#stay" char="\\" char1="'" />
+ <Detect2Chars attribute="Escape" context="#stay" char="\\" char1="&quot;" />
+ <DetectChar attribute="String SingleQ" context="StringSQ" char="'" />
+ <DetectChar attribute="String DoubleQ" context="StringDQ" char="&quot;" />
+ <Detect2Chars attribute="String SingleQ" context="StringEsc" char="$" char1="'" />
+ <Detect2Chars attribute="String Transl." context="StringDQ" char="$" char1="&quot;" />
</context>
-
+
<!-- FindSubstitutions goes after anything starting with $ and ` and their escapes -->
<context attribute="Normal Text" lineEndContext="#stay" name="FindSubstitutions">
- <RegExpr attribute="Variable" context="#stay" String="\$[*@#?$!_0-9-]" />
- <RegExpr attribute="Variable" context="Subscript" String="\$&varname;\[" />
- <RegExpr attribute="Variable" context="#stay" String="\$&varname;" />
- <RegExpr attribute="Variable" context="#stay" String="\$\{[*@#?$!_0-9-]\}" />
- <RegExpr attribute="Variable" context="#stay" String="\$\{#&varname;\}" />
- <RegExpr attribute="Variable" context="#stay" String="\$\{!&varname;\*?\}" />
- <RegExpr attribute="Variable" context="VarBrace" String="\$\{&varname;" />
- <RegExpr attribute="Variable" context="VarBrace" String="\$\{[*@#?$!_0-9-](?=[:#%/])" />
- <StringDetect attribute="Variable" context="ExprDblParenSubst" String="$((" beginRegion="expression" />
- <StringDetect attribute="Redirection" context="SubstFile" String="$(&lt;" />
+ <RegExpr attribute="Variable" context="Subscript" String="\$&varname;\[" />
+ <RegExpr attribute="Variable" context="#stay" String="\$&varname;" />
+ <RegExpr attribute="Variable" context="#stay" String="\$[*@#?$!_0-9-]" />
+ <RegExpr attribute="Variable" context="#stay" String="\$\{[*@#?$!_0-9-]\}" />
+ <RegExpr attribute="Variable" context="#stay" String="\$\{#&varname;(\[[*@]\])?\}" />
+ <RegExpr attribute="Variable" context="#stay" String="\$\{!&varname;(\[[*@]\]|[*@])?\}" />
+ <RegExpr attribute="Variable" context="VarBrace" String="\$\{&varname;" />
+ <RegExpr attribute="Variable" context="VarBrace" String="\$\{[*@#?$!_0-9-](?=[:#%/=?+-])" />
+ <StringDetect attribute="Variable" context="ExprDblParenSubst" String="$((" beginRegion="expression" />
+ <StringDetect attribute="Redirection" context="SubstFile" String="$(&lt;" />
<StringDetect attribute="Variable" context="SubstCommand" String="$(" />
- <DetectChar attribute="Backquote" context="SubstBackq" char="`" />
- <RegExpr attribute="Escape" context="#stay" String="\\[`$\\]" />
+ <DetectChar attribute="Backquote" context="SubstBackq" char="`" />
+ <RegExpr attribute="Escape" context="#stay" String="\\[`$\\]" />
+ </context>
+
+ <!-- FindTests finds operators valid in tests -->
+ <context attribute="Normal Text" lineEndContext="#stay" name="FindTests">
+ <RegExpr attribute="Expression" context="#stay" String="-[abcdefghkprstuwxOGLSNozn](?=\s)"/>
+ <RegExpr attribute="Expression" context="#stay" String="-([no]t|ef)(?=\s)"/>
+ <RegExpr attribute="Expression" context="#stay" String="([!=]=?|[&gt;&lt;])(?=\s)"/>
+ <RegExpr attribute="Expression" context="#stay" String="-(eq|ne|[gl][te])(?=\s)"/>
</context>
-
-
-
<!-- ====== These are the contexts that can be branched to ======= -->
<!-- ExprDblParen consumes an expression started in command mode till )) -->
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblParen">
- <Detect2Chars attribute="Keyword" context="#pop" char=")" char1=")" endRegion="expression" />
- <DetectChar attribute="Normal Text" context="ExprSubParen" char="(" />
- <IncludeRules context="FindMost" />
+ <Detect2Chars attribute="Keyword" context="#pop" char=")" char1=")" endRegion="expression" />
+ <DetectChar attribute="Normal Text" context="ExprSubParen" char="(" />
+ <IncludeRules context="FindMost" />
</context>
-
+
<!-- ExprDblParenSubst like ExprDblParen but matches )) as Variable -->
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblParenSubst">
- <Detect2Chars attribute="Variable" context="#pop" char=")" char1=")" endRegion="expression" />
- <DetectChar attribute="Normal Text" context="ExprSubParen" char="(" />
- <IncludeRules context="FindMost" />
+ <Detect2Chars attribute="Variable" context="#pop" char=")" char1=")" endRegion="expression" />
+ <DetectChar attribute="Normal Text" context="ExprSubParen" char="(" />
+ <IncludeRules context="FindMost" />
</context>
<!-- ExprSubParen consumes an expression till ) -->
<context attribute="Normal Text" lineEndContext="#stay" name="ExprSubParen">
- <DetectChar attribute="Normal Text" context="#pop" char=")" />
- <DetectChar attribute="Normal Text" context="ExprSubParen" char="(" />
- <IncludeRules context="FindMost" />
+ <DetectChar attribute="Normal Text" context="#pop" char=")" />
+ <DetectChar attribute="Normal Text" context="ExprSubParen" char="(" />
+ <IncludeRules context="FindMost" />
</context>
<!-- ExprBracket consumes an expression till ] -->
<context attribute="Normal Text" lineEndContext="#stay" name="ExprBracket">
- <RegExpr attribute="Builtin" context="#pop" String="\s\](?=($|[\s;|&amp;]))" endRegion="expression" />
- <RegExpr attribute="Builtin" context="#pop" String="\](?=($|[\s;|&amp;]))" endRegion="expression" column="0"/>
- <DetectChar attribute="Normal Text" context="ExprSubParen" char="(" />
- <IncludeRules context="FindMost" />
+ <RegExpr attribute="Builtin" context="#pop" String="\s\](?=($|[\s;|&amp;]))" endRegion="expression" />
+ <RegExpr attribute="Builtin" context="#pop" String="\](?=($|[\s;|&amp;]))" endRegion="expression" column="0"/>
+ <DetectChar attribute="Normal Text" context="ExprSubParen" char="(" />
+ <IncludeRules context="FindTests" />
+ <IncludeRules context="FindMost" />
</context>
<!-- ExprDblBracket consumes an expression till ]] -->
<context attribute="Normal Text" lineEndContext="#stay" name="ExprDblBracket">
- <RegExpr attribute="Keyword" context="#pop" String="\s\]\](?=($|[\s;|&amp;]))" endRegion="expression" />
- <RegExpr attribute="Keyword" context="#pop" String="\]\](?=($|[\s;|&amp;]))" endRegion="expression" column="0"/>
- <DetectChar attribute="Normal Text" context="ExprSubParen" char="(" />
- <IncludeRules context="FindMost" />
+ <RegExpr attribute="Keyword" context="#pop" String="\s\]\](?=($|[\s;|&amp;]))" endRegion="expression" />
+ <RegExpr attribute="Keyword" context="#pop" String="\]\](?=($|[\s;|&amp;]))" endRegion="expression" column="0"/>
+ <DetectChar attribute="Normal Text" context="ExprSubParen" char="(" />
+ <IncludeRules context="FindTests" />
+ <IncludeRules context="FindMost" />
</context>
<!-- Group consumes shell input till } -->
<context attribute="Normal Text" lineEndContext="#stay" name="Group">
- <DetectChar attribute="Keyword" context="#pop" char="}" endRegion="group" />
- <IncludeRules context="FindAll" />
- </context>
+ <DetectChar attribute="Keyword" context="#pop" char="}" endRegion="group" />
+ <IncludeRules context="FindAll" />
+ </context>
<!-- SubShell consumes shell input till ) -->
<context attribute="Normal Text" lineEndContext="#stay" name="SubShell">
- <DetectChar attribute="Keyword" context="#pop" char=")" endRegion="subshell" />
- <IncludeRules context="FindAll" />
- </context>
+ <DetectChar attribute="Keyword" context="#pop" char=")" endRegion="subshell" />
+ <IncludeRules context="FindAll" />
+ </context>
<!-- Assign consumes an expression till EOL or whitespace -->
<context attribute="Normal Text" lineEndContext="#pop" name="Assign" fallthrough="true" fallthroughContext="#pop">
- <DetectChar attribute="Variable" context="AssignArray" char="(" />
- <IncludeRules context="FindStrings" />
- <IncludeRules context="FindSubstitutions" />
- <IncludeRules context="FindOthers" />
- <RegExpr attribute="Normal Text" context="#stay" String="[\w:,+_./-]+" />
+ <DetectChar attribute="Variable" context="AssignArray" char="(" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindSubstitutions" />
+ <IncludeRules context="FindOthers" />
+ <RegExpr attribute="Normal Text" context="#stay" String="[\w:,+_./-]" />
</context>
<!-- AssignArray consumes everything till ), marking assignments -->
<context attribute="Normal Text" lineEndContext="#pop" name="AssignArray">
- <DetectChar attribute="Variable" context="#pop" char=")" />
- <DetectChar attribute="Variable" context="Subscript" char="[" />
- <DetectChar attribute="Variable" context="Assign" char="=" />
- <IncludeRules context="FindMost" />
+ <DetectChar attribute="Variable" context="#pop" char=")" />
+ <DetectChar attribute="Variable" context="Subscript" char="[" />
+ <DetectChar attribute="Variable" context="Assign" char="=" />
+ <IncludeRules context="FindMost" />
</context>
-
+
<!-- AssignSubscr first expects a [ then parses subscript and continues with '=value' -->
<context attribute="Normal Text" lineEndContext="#pop" name="AssignSubscr" fallthrough="true" fallthroughContext="#pop">
- <DetectChar attribute="Variable" context="Subscript" char="[" />
- <DetectChar attribute="Variable" context="Assign" char="=" />
- <IncludeRules context="FindStrings" />
- <IncludeRules context="FindSubstitutions" />
- <IncludeRules context="FindOthers" />
+ <DetectChar attribute="Variable" context="Subscript" char="[" />
+ <Detect2Chars attribute="Variable" context="Assign" char="+" char1="=" />
+ <DetectChar attribute="Variable" context="Assign" char="=" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindSubstitutions" />
+ <IncludeRules context="FindOthers" />
</context>
<!-- Subscript consumes anything till ], marks as Variable -->
<context attribute="Variable" lineEndContext="#stay" name="Subscript">
- <DetectChar attribute="Variable" context="#pop" char="]" />
- <IncludeRules context="FindStrings" />
- <IncludeRules context="FindSubstitutions" />
- <IncludeRules context="FindOthers" />
+ <DetectChar attribute="Variable" context="#pop" char="]" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindSubstitutions" />
+ <IncludeRules context="FindOthers" />
</context>
-
+
<!-- FunctionDef consumes a name, possibly with (), marks as Function -->
<context attribute="Function" lineEndContext="#pop" name="FunctionDef" fallthrough="true" fallthroughContext="#pop">
- <RegExpr attribute="Function" context="#pop" String="\s+&funcname;(\s*\(\))?" />
- </context>
-
+ <RegExpr attribute="Function" context="#pop" String="\s+&funcname;(\s*\(\))?" />
+ </context>
+
<!-- VarName consumes spare variable names and assignments -->
<context attribute="Normal Text" lineEndContext="#pop" name="VarName" fallthrough="true" fallthroughContext="#pop">
- <!-- handle command line options -->
- <RegExpr attribute="Option" context="#stay" String="-[A-Za-z0-9]+" />
- <RegExpr attribute="Option" context="#stay" String="--[a-z][A-Za-z0-9_-]*" />
- <RegExpr attribute="Variable" context="#stay" String="\b&varname;" />
- <DetectChar attribute="Variable" context="Subscript" char="[" />
- <DetectChar attribute="Variable" context="Assign" char="=" />
- <IncludeRules context="FindMost" />
- <!-- stay here in spaces and other safe characters -->
- <RegExpr attribute="Normal Text" context="#stay" String="[^]})|;`&amp;&gt;&lt;]" />
+ <!-- handle command line options -->
+ <RegExpr attribute="Option" context="#stay" String="-[A-Za-z0-9]+" />
+ <RegExpr attribute="Option" context="#stay" String="--[a-z][A-Za-z0-9_-]*" />
+ <RegExpr attribute="Variable" context="#stay" String="\b&varname;" />
+ <DetectChar attribute="Variable" context="Subscript" char="[" />
+ <DetectChar attribute="Variable" context="Assign" char="=" />
+ <IncludeRules context="FindMost" />
+ <!-- stay here in spaces and other safe characters -->
+ <RegExpr attribute="Normal Text" context="#stay" String="[^]})|;`&amp;&gt;&lt;]" />
</context>
<!-- ProcessSubst handles <(command) and >(command) -->
<context attribute="Normal Text" lineEndContext="#stay" name="ProcessSubst">
- <DetectChar attribute="Redirection" context="#pop" char=")" />
- <IncludeRules context="FindCommentsParen" />
- <IncludeRules context="FindCommands" />
- <IncludeRules context="FindStrings" />
- <IncludeRules context="FindSubstitutions" />
- <IncludeRules context="FindOthers" />
+ <DetectChar attribute="Redirection" context="#pop" char=")" />
+ <IncludeRules context="FindCommentsParen" />
+ <IncludeRules context="FindCommands" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindSubstitutions" />
+ <IncludeRules context="FindOthers" />
</context>
- <!-- StringSQ consumes anything till ' -->
+ <!-- StringSQ consumes anything till ' -->
<context attribute="String SingleQ" lineEndContext="#stay" name="StringSQ">
- <DetectChar attribute="String SingleQ" context="#pop" char="'" />
+ <DetectChar attribute="String SingleQ" context="#pop" char="'" />
</context>
<!-- StringDQ consumes anything till ", substitutes vars and expressions -->
<context attribute="String DoubleQ" lineEndContext="#stay" name="StringDQ">
- <DetectChar attribute="String DoubleQ" context="#pop" char="&quot;" />
- <RegExpr attribute="String Escape" context="#stay" String="\\[`&quot;\\$\n]" />
- <IncludeRules context="FindSubstitutions" />
+ <DetectChar attribute="String DoubleQ" context="#pop" char="&quot;" />
+ <RegExpr attribute="String Escape" context="#stay" String="\\[`&quot;\\$\n]" />
+ <IncludeRules context="FindSubstitutions" />
</context>
-
+
<!-- StringEsc eats till ', but escaping many characters -->
<context attribute="String SingleQ" lineEndContext="#stay" name="StringEsc">
- <DetectChar attribute="String SingleQ" context="#pop" char="'" />
- <RegExpr attribute="String Escape" context="#stay" String="\\[abefnrtv\\']" />
- <RegExpr attribute="String Escape" context="#stay" String="\\([0-7]{1,3}|x[A-Fa-f0-9]{1,2}|c.)" />
+ <DetectChar attribute="String SingleQ" context="#pop" char="'" />
+ <RegExpr attribute="String Escape" context="#stay" String="\\[abefnrtv\\']" />
+ <RegExpr attribute="String Escape" context="#stay" String="\\([0-7]{1,3}|x[A-Fa-f0-9]{1,2}|c.)" />
</context>
<!-- VarBrace is called as soon as ${xxx is encoutered -->
- <context attribute="Variable" lineEndContext="#stay" name="VarBrace">
+ <context attribute="Error" lineEndContext="#stay" name="VarBrace">
<DetectChar attribute="Variable" context="#pop" char="}" />
- <DetectChar attribute="Variable" context="Subscript" char="[" />
- <IncludeRules context="FindStrings" />
- <IncludeRules context="FindSubstitutions" />
- <!-- TODO: highlight various special parameter expansions } -->
+ <DetectChar attribute="Variable" context="Subscript" char="[" />
+ <RegExpr attribute="Variable" context="VarAlt" String="(:?[-=?+]|##?|%%?)" />
+ <RegExpr attribute="Variable" context="VarSubst" String="//?" />
+ <DetectChar attribute="Variable" context="VarSub" char=":" />
+ </context>
+
+ <!-- VarAlt is to handle default/alternate/etc values of variables -->
+ <context attribute="Normal Text" lineEndContext="#stay" name="VarAlt">
+ <DetectChar attribute="Variable" context="#pop#pop" char="}" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindSubstitutions" />
+ </context>
+
+ <!-- VarSubst is to handle substitutions on variables -->
+ <context attribute="Normal Text" lineEndContext="#stay" name="VarSubst">
+ <DetectChar attribute="Variable" context="#pop#pop" char="}" />
+ <DetectChar attribute="Variable" context="VarSubst2" char="/" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindSubstitutions" />
</context>
-
+ <context attribute="Normal Text" lineEndContext="#stay" name="VarSubst2">
+ <DetectChar attribute="Variable" context="#pop#pop#pop" char="}" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindSubstitutions" />
+ </context>
+
+ <!-- VarSub is to substrings of variables -->
+ <context attribute="Error" lineEndContext="#stay" name="VarSub">
+ <DetectChar attribute="Variable" context="VarSub2" char=":" />
+ <DetectChar attribute="Variable" context="#pop#pop" char="}" />
+ <RegExpr attribute="Variable" context="#stay" String="&varname;" />
+ <RegExpr attribute="Variable" context="#stay" String="[0-9]+(?=[:}])" />
+ <IncludeRules context="FindSubstitutions" />
+ </context>
+ <context attribute="Error" lineEndContext="#stay" name="VarSub2">
+ <DetectChar attribute="Variable" context="#pop#pop#pop" char="}" />
+ <RegExpr attribute="Variable" context="#stay" String="&varname;" />
+ <RegExpr attribute="Variable" context="#stay" String="[0-9](?=[:}])" />
+ <IncludeRules context="FindSubstitutions" />
+ </context>
+
+
<!-- SubstFile is called after a <( or >( is encoutered -->
<context attribute="Normal Text" lineEndContext="#stay" name="SubstFile">
- <DetectChar attribute="Redirection" context="#pop" char=")" />
- <IncludeRules context="FindCommentsParen" />
- <IncludeRules context="FindStrings" />
- <IncludeRules context="FindSubstitutions" />
- <IncludeRules context="FindOthers" />
+ <DetectChar attribute="Redirection" context="#pop" char=")" />
+ <IncludeRules context="FindCommentsParen" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindSubstitutions" />
+ <IncludeRules context="FindOthers" />
</context>
-
+
<!-- SubstCommand is called after a $( is encountered -->
<context attribute="Normal Text" lineEndContext="#stay" name="SubstCommand">
- <DetectChar attribute="Variable" context="#pop" char=")" />
- <IncludeRules context="FindCommentsParen" />
- <IncludeRules context="FindCommands" />
- <IncludeRules context="FindStrings" />
- <IncludeRules context="FindSubstitutions" />
- <IncludeRules context="FindOthers" />
- </context>
-
+ <DetectChar attribute="Variable" context="#pop" char=")" />
+ <IncludeRules context="FindCommentsParen" />
+ <IncludeRules context="FindCommands" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindSubstitutions" />
+ <IncludeRules context="FindOthers" />
+ </context>
+
<!-- SubstBackq is called when a backquote is encountered -->
<context attribute="Normal Text" lineEndContext="#stay" name="SubstBackq">
- <DetectChar attribute="Keyword" context="#pop" char="`" />
- <IncludeRules context="FindCommentsBackq" />
- <IncludeRules context="FindCommands" />
- <IncludeRules context="FindStrings" />
- <IncludeRules context="FindSubstitutions" />
- <IncludeRules context="FindOthers" />
+ <DetectChar attribute="Backquote" context="#pop" char="`" />
+ <IncludeRules context="FindCommentsBackq" />
+ <IncludeRules context="FindCommands" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindSubstitutions" />
+ <IncludeRules context="FindOthers" />
</context>
<!-- Case is called after the case keyword is encoutered. We handle this because of
@@ -747,58 +802,59 @@
<!-- CaseIn is called when the construct 'case ... in' has been found. -->
<context attribute="Normal Text" lineEndContext="#stay" name="CaseIn">
<RegExpr attribute="Keyword" context="#pop#pop" String="\besac(?=$|[\s;)])" endRegion="case" />
- <DetectChar attribute="Keyword" context="CaseExpr" char=")" beginRegion="caseexpr" />
- <AnyChar attribute="Keyword" context="#stay" String="(|" />
+ <DetectChar attribute="Keyword" context="CaseExpr" char=")" beginRegion="caseexpr" />
+ <AnyChar attribute="Keyword" context="#stay" String="(|" />
<IncludeRules context="FindMost" />
</context>
<!-- CaseExpr eats shell input till ;; -->
<context attribute="Normal Text" lineEndContext="#stay" name="CaseExpr">
<Detect2Chars attribute="Keyword" context="#pop" char=";" char1=";" endRegion="caseexpr" />
- <IncludeRules context="FindAll" />
+ <RegExpr attribute="Keyword" context="#pop" String="esac(?=$|[\s;)])" lookAhead="true" firstNonSpace="true" endRegion="caseexpr"/>
+ <IncludeRules context="FindAll" />
</context>
<!-- HereDoc consumes Here-documents. It is called at the beginning of the "<<" construct. -->
<context attribute="Normal Text" lineEndContext="#stay" name="HereDoc">
- <RegExpr attribute="Redirection" context="HereDocQ" String="(&lt;&lt;\s*&quot;(&word;)&quot;)" lookAhead="true" />
- <RegExpr attribute="Redirection" context="HereDocQ" String="(&lt;&lt;\s*'(&word;)')" lookAhead="true" />
- <RegExpr attribute="Redirection" context="HereDocQ" String="(&lt;&lt;\s*\\(&word;))" lookAhead="true" />
- <RegExpr attribute="Redirection" context="HereDocNQ" String="(&lt;&lt;(?!-)\s*(&word;))" lookAhead="true" />
- <RegExpr attribute="Redirection" context="HereDocIQ" String="(&lt;&lt;-\s*&quot;(&word;)&quot;)" lookAhead="true" />
- <RegExpr attribute="Redirection" context="HereDocIQ" String="(&lt;&lt;-\s*'(&word;)')" lookAhead="true" />
- <RegExpr attribute="Redirection" context="HereDocIQ" String="(&lt;&lt;-\s*\\(&word;))" lookAhead="true" />
- <RegExpr attribute="Redirection" context="HereDocINQ" String="(&lt;&lt;-\s*(&word;))" lookAhead="true" />
- <StringDetect attribute="Redirection" context="#pop" String="&lt;&lt;" /><!-- always met -->
+ <RegExpr attribute="Redirection" context="HereDocIQ" String="(&lt;&lt;-\s*&quot;(&word;)&quot;)" lookAhead="true" />
+ <RegExpr attribute="Redirection" context="HereDocIQ" String="(&lt;&lt;-\s*'(&word;)')" lookAhead="true" />
+ <RegExpr attribute="Redirection" context="HereDocIQ" String="(&lt;&lt;-\s*\\(&word;))" lookAhead="true" />
+ <RegExpr attribute="Redirection" context="HereDocINQ" String="(&lt;&lt;-\s*(&word;))" lookAhead="true" />
+ <RegExpr attribute="Redirection" context="HereDocQ" String="(&lt;&lt;\s*&quot;(&word;)&quot;)" lookAhead="true" />
+ <RegExpr attribute="Redirection" context="HereDocQ" String="(&lt;&lt;\s*'(&word;)')" lookAhead="true" />
+ <RegExpr attribute="Redirection" context="HereDocQ" String="(&lt;&lt;\s*\\(&word;))" lookAhead="true" />
+ <RegExpr attribute="Redirection" context="HereDocNQ" String="(&lt;&lt;\s*(&word;))" lookAhead="true" />
+ <StringDetect attribute="Redirection" context="#pop" String="&lt;&lt;" /><!-- always met -->
</context>
<context attribute="Normal Text" lineEndContext="#pop" name="HereDocRemainder">
- <IncludeRules context="FindAll" />
+ <IncludeRules context="FindAll" />
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="HereDocQ" dynamic="true">
- <RegExpr attribute="Redirection" context="HereDocRemainder" String="%1" dynamic="true" />
- <RegExpr attribute="Redirection" context="#pop#pop" String="%2[\s;]*$" dynamic="true" column="0"/>
+ <RegExpr attribute="Redirection" context="HereDocRemainder" String="%1" dynamic="true" />
+ <RegExpr attribute="Redirection" context="#pop#pop" String="^%2\b" dynamic="true" column="0"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="HereDocNQ" dynamic="true">
- <RegExpr attribute="Redirection" context="HereDocRemainder" String="%1" dynamic="true" />
- <RegExpr attribute="Redirection" context="#pop#pop" String="%2[\s;]*$" dynamic="true" column="0"/>
- <IncludeRules context="FindSubstitutions" />
+ <RegExpr attribute="Redirection" context="HereDocRemainder" String="%1" dynamic="true" />
+ <RegExpr attribute="Redirection" context="#pop#pop" String="^%2\b" dynamic="true" column="0"/>
+ <IncludeRules context="FindSubstitutions" />
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="HereDocIQ" dynamic="true">
- <RegExpr attribute="Redirection" context="HereDocRemainder" String="%1" dynamic="true" />
- <RegExpr attribute="Redirection" context="#pop#pop" String="\s*%2[\s;]*$" dynamic="true" column="0"/>
+ <RegExpr attribute="Redirection" context="HereDocRemainder" String="%1" dynamic="true" />
+ <RegExpr attribute="Redirection" context="#pop#pop" String="^\t*%2\b" dynamic="true" column="0"/>
</context>
<context attribute="Normal Text" lineEndContext="#stay" name="HereDocINQ" dynamic="true">
- <RegExpr attribute="Redirection" context="HereDocRemainder" String="%1" dynamic="true" />
- <RegExpr attribute="Redirection" context="#pop#pop" String="\s*%2[\s;]*$" dynamic="true" column="0"/>
- <IncludeRules context="FindSubstitutions" />
+ <RegExpr attribute="Redirection" context="HereDocRemainder" String="%1" dynamic="true" />
+ <RegExpr attribute="Redirection" context="#pop#pop" String="^\t*%2\b" dynamic="true" column="0"/>
+ <IncludeRules context="FindSubstitutions" />
</context>
</contexts>
-
+
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" />
<itemData name="Comment" defStyleNum="dsComment" />
@@ -815,15 +871,16 @@
<itemData name="String Escape" defStyleNum="dsDataType" />
<itemData name="Variable" defStyleNum="dsOthers" />
<itemData name="Expression" defStyleNum="dsOthers" />
- <itemData name="Function" defStyleNum="dsChar" bold="1" />
+ <itemData name="Function" defStyleNum="dsFunction" />
<itemData name="Path" defStyleNum="dsNormal" />
<itemData name="Option" defStyleNum="dsNormal" />
+ <itemData name="Error" defStyleNum="dsError" />
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="#"/>
</comments>
- <keywords casesensitive="1" weakDeliminator="^%#[]$._{}:-" additionalDeliminator="`"/>
+ <keywords casesensitive="1" weakDeliminator="^%#[]$._{}:-/" additionalDeliminator="`"/>
</general>
</language>