<?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|do|else|case.*in)\s*(#.*)?$" />
		<PROPERTY NAME="unindentThisLine"
			VALUE="^\s*(fi|else|done|esac|[^(]*\).*)\s*(#.*)?$" />
		<PROPERTY NAME="unindentNextLines"
			VALUE="^\s*(fi|else|done|esac)\s*(#.*)?$" />
		<!-- 3 possible values for electricKeys may be considered
		  1. electric enter and the bracket: ")&#xA;"
		  2. letters ending unindent rules ")iec"
		  3. all letters ")abcdefghijklmnopqrstuvwxyz"
		  details: http://jedit.9.n6.nabble.com/jEdit-devel-electric-keys-for-shell-mode-tp4998749.html
		-->
		<PROPERTY NAME="electricKeys" VALUE=")abcdefghijklmnopqrstuvwxyz" />
	</PROPS>
	<RULES IGNORE_CASE="TRUE" HIGHLIGHT_DIGITS="TRUE">
		<!-- Comments -->
		<EOL_SPAN TYPE="COMMENT2">#!</EOL_SPAN>
		<EOL_SPAN TYPE="COMMENT1">#</EOL_SPAN>

		<!-- BUG #3594428 (Bash Syntax Highlighting) -->
		<SPAN TYPE="KEYWORD2" DELEGATE="LITERAL" 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" ESCAPE="\">
			<BEGIN>$((</BEGIN>
			<END>))</END>
		</SPAN>
		<SPAN TYPE="KEYWORD3" DELEGATE="EXEC" ESCAPE="\">
			<BEGIN>$(</BEGIN>
			<END>)</END>
		</SPAN>
		<SPAN TYPE="KEYWORD3" DELEGATE="EXEC" ESCAPE="\">
			<BEGIN>$[</BEGIN>
			<END>]</END>
		</SPAN>
		<SPAN TYPE="KEYWORD3" DELEGATE="EXEC" ESCAPE="\">
			<BEGIN>`</BEGIN>
			<END>`</END>
		</SPAN>

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

		<!-- Readins -->
		<SPAN_REGEXP HASH_CHAR="&lt;&lt;" TYPE="LITERAL1" DELEGATE="LITERAL" ESCAPE="\">
			<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>
