<?xml version="1.0"?>

<!DOCTYPE MODE SYSTEM "xmode.dtd">

<MODE>
	<PROPS>
		<PROPERTY NAME="lineComment" VALUE="#" />
		<PROPERTY NAME="indentOpenBrackets" VALUE="{" />
		<PROPERTY NAME="indentCloseBrackets" VALUE="}" />
		<PROPERTY NAME="indentNextLines"
			VALUE="^.*(then|else|case.*in)$" />
		<PROPERTY NAME="unindentThisLine"
			VALUE="^\s*(fi|else|esac|.*\))$" />
		<PROPERTY NAME="unindentNextLines"
			VALUE="^\s*(fi|else|esac)$" />
	</PROPS>
	<RULES IGNORE_CASE="TRUE" HIGHLIGHT_DIGITS="TRUE" ESCAPE="\">
		<!-- Comments -->
		<EOL_SPAN TYPE="COMMENT2">#!</EOL_SPAN>
		<EOL_SPAN TYPE="COMMENT1">#</EOL_SPAN>

		<!-- Variables -->
		<SPAN TYPE="KEYWORD2" NO_LINE_BREAK="TRUE">
			<BEGIN>${</BEGIN>
			<END>}</END>
		</SPAN>

		<MARK_FOLLOWING TYPE="KEYWORD2">$#</MARK_FOLLOWING>
		<MARK_FOLLOWING TYPE="KEYWORD2">$?</MARK_FOLLOWING>
		<MARK_FOLLOWING TYPE="KEYWORD2">$*</MARK_FOLLOWING>
		<MARK_FOLLOWING TYPE="KEYWORD2">$@</MARK_FOLLOWING>
		<MARK_FOLLOWING TYPE="KEYWORD2">$$</MARK_FOLLOWING>
		<MARK_FOLLOWING TYPE="KEYWORD2">$&lt;</MARK_FOLLOWING>
		<MARK_FOLLOWING TYPE="KEYWORD2">$</MARK_FOLLOWING>
		<MARK_PREVIOUS TYPE="KEYWORD2" MATCH_TYPE="OPERATOR">=</MARK_PREVIOUS>

		<!-- weird stuff -->
		<SPAN TYPE="KEYWORD3" DELEGATE="EXEC">
			<BEGIN>$((</BEGIN>
			<END>))</END>
		</SPAN>
		<SPAN TYPE="KEYWORD3" DELEGATE="EXEC">
			<BEGIN>$(</BEGIN>
			<END>)</END>
		</SPAN>
		<SPAN TYPE="KEYWORD3" DELEGATE="EXEC">
			<BEGIN>$[</BEGIN>
			<END>]</END>
		</SPAN>
		<SPAN TYPE="KEYWORD3" DELEGATE="EXEC">
			<BEGIN>`</BEGIN>
			<END>`</END>
		</SPAN>

		<!-- Literals -->
		<SPAN TYPE="LITERAL1" DELEGATE="LITERAL">
			<BEGIN>"</BEGIN>
			<END>"</END>
		</SPAN>
		<SPAN TYPE="LITERAL1" ESCAPE="\">
			<BEGIN>'</BEGIN>
			<END>'</END>
		</SPAN>

		<!-- Readins -->
		<SPAN_REGEXP HASH_CHAR="&lt;&lt;" TYPE="LITERAL1" DELEGATE="LITERAL">
			<BEGIN><![CDATA[<<[\p{Space}'"]*([\p{Alnum}_]+)[\p{Space}'"]*]]></BEGIN>
			<END AT_LINE_START="TRUE">$1</END>
		</SPAN_REGEXP>

		<!-- Operators -->
		<SEQ TYPE="OPERATOR">|</SEQ>
		<SEQ TYPE="OPERATOR">&amp;</SEQ>
		<SEQ TYPE="OPERATOR">!</SEQ>
		<SEQ TYPE="OPERATOR">&gt;</SEQ>
		<SEQ TYPE="OPERATOR">&lt;</SEQ>

		<!-- %jobnumber -->
		<MARK_FOLLOWING TYPE="KEYWORD2">%</MARK_FOLLOWING>

		<!-- functions -->
		<MARK_PREVIOUS TYPE="FUNCTION" MATCH_TYPE="OPERATOR">(</MARK_PREVIOUS>
		<SEQ TYPE="OPERATOR">)</SEQ>

		<KEYWORDS>
			<KEYWORD1>if</KEYWORD1>
			<KEYWORD1>then</KEYWORD1>
			<KEYWORD1>elif</KEYWORD1>
			<KEYWORD1>else</KEYWORD1>
			<KEYWORD1>fi</KEYWORD1>
			<KEYWORD1>case</KEYWORD1>
			<KEYWORD1>in</KEYWORD1>
			<OPERATOR>;;</OPERATOR>
			<KEYWORD1>esac</KEYWORD1>
			<KEYWORD1>while</KEYWORD1>
			<KEYWORD1>for</KEYWORD1>
			<KEYWORD1>do</KEYWORD1>
			<KEYWORD1>done</KEYWORD1>
			<KEYWORD1>continue</KEYWORD1>

			<KEYWORD1>local</KEYWORD1>
			<KEYWORD1>return</KEYWORD1>
		</KEYWORDS>

		<!-- some of these should be marked OPERATOR -->
		<!-- <SEQ TYPE="NULL">)</SEQ>
		<SEQ TYPE="NULL">(</SEQ>
		<SEQ TYPE="NULL">=</SEQ>
		<SEQ TYPE="NULL">!</SEQ>
		<SEQ TYPE="NULL">&gt;=</SEQ>
		<SEQ TYPE="NULL">&lt;=</SEQ>
		<SEQ TYPE="NULL">+</SEQ>
		<SEQ TYPE="NULL">-</SEQ>
		<SEQ TYPE="NULL">/</SEQ>
		<SEQ TYPE="NULL">*</SEQ>
		<SEQ TYPE="NULL">^</SEQ>
		<SEQ TYPE="NULL">~</SEQ>
		<SEQ TYPE="NULL">}</SEQ>
		<SEQ TYPE="NULL">{</SEQ>
		SEQ TYPE="NULL">.</SEQ
		<SEQ TYPE="NULL">,</SEQ>
		<SEQ TYPE="NULL">;</SEQ>
		<SEQ TYPE="NULL">]</SEQ>
		<SEQ TYPE="NULL">[</SEQ>
		<SEQ TYPE="NULL">?</SEQ>
		<SEQ TYPE="NULL">:</SEQ> -->
	</RULES>

	<RULES SET="LITERAL" DEFAULT="LITERAL1" ESCAPE="\">
		<!-- Variables -->
		<SPAN TYPE="KEYWORD2" NO_LINE_BREAK="TRUE">
			<BEGIN>${</BEGIN>
			<END>}</END>
		</SPAN>

		<MARK_FOLLOWING TYPE="KEYWORD2">$</MARK_FOLLOWING>
	</RULES>

	<RULES SET="EXEC" DEFAULT="KEYWORD3" ESCAPE="\">
		<!-- Variables -->
		<SPAN TYPE="KEYWORD2" NO_LINE_BREAK="TRUE">
			<BEGIN>${</BEGIN>
			<END>}</END>
		</SPAN>

		<SPAN TYPE="KEYWORD3">
			<BEGIN>$((</BEGIN>
			<END>))</END>
		</SPAN>

		<SPAN TYPE="KEYWORD3">
			<BEGIN>$(</BEGIN>
			<END>)</END>
		</SPAN>

		<SPAN TYPE="KEYWORD3">
			<BEGIN>$[</BEGIN>
			<END>]</END>
		</SPAN>

		<MARK_FOLLOWING TYPE="KEYWORD2">$</MARK_FOLLOWING>

		<SEQ TYPE="OPERATOR">|</SEQ>
		<SEQ TYPE="OPERATOR">&amp;</SEQ>
		<SEQ TYPE="OPERATOR">!</SEQ>
		<SEQ TYPE="OPERATOR">&gt;</SEQ>
		<SEQ TYPE="OPERATOR">&lt;</SEQ>
	</RULES>
</MODE>
