<?xml version="1.0" encoding="UTF-8"?>
<syntax name="language-root.ruby">
	<zones>
		<include collection="language" />
	</zones>
	<library>
		<collection name="language">
			<!-- We use a language collection because Ruby can be embedded in <% %> blocks in HTML -->
			<include collection="comments" />
			<include collection="strings" />
			<include collection="regex" />
			<include collection="item-blocks" />
			<include collection="keywords" />
			<include collection="variables" />
			<include collection="punctuation" />
		</collection>
		<!-- Comments -->
		<collection name="comments">
			<zone>
				<expression>(^(#!).*?\bruby\b.*?$[\n\r]*)|((#)\s*(?:[*#=~+-]{3,}|!).*$[\n\r]*)</expression>
				<!-- Shebangs -->
				<capture number="1" name="comment.shebang"/>
				<capture number="2" name="punctuation.definition.begin"/>
				<!-- Bookmarks -->
				<capture number="3" name="comment.line.bookmark"/>
				<capture number="4" name="punctuation.definition.begin"/>
			</zone>
			<!-- FIXME: Can I collapse this into the above zone (with subzones in the captures)? -->
			<zone name="comment.line.task">
				<starts-with>
					<expression>(#)(?=.*?\b(?i:FIX ?ME|TODO)\b)</expression>
					<capture number="1" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>$[\n\r]*</expression>
				</ends-with>
				<subzones>
					<zone name="keyword">
						<expression>\b(?i:FIX ?ME|TODO)\b</expression>
					</zone>
				</subzones>
			</zone>
			<zone name="comment.line">
				<expression>(#).*$[\n\r]*</expression>
				<capture number="1" name="punctuation.definition.begin"/>
			</zone>
			<zone name="comment.documentation">
				<starts-with>
					<expression>^=begin\b</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>^=end$</expression>
					<capture number="0" name="punctuation.definition.end"/>
				</ends-with>
			</zone>
		</collection>
		
		<!-- Strings -->
		<collection name="strings">
			<!--'property': (within object literals)-->
			<!-- Technically, we should be supporting the % delimited version of strings here, too. But given that it would create half a dozen extra syntax zones and very little benefit, why bother? -->
			<zone>
				<expression>(?&lt;=^|,|\{)\s*(((')((?:\\'|[^'])*?)((?&lt;!\\)'))\s*(=>))\s*</expression>
				<capture number="1" name="variable.property.x-assignment"/>
				<capture number="2" name="string.quoted.single"/>
				<capture number="3" name="punctuation.definition.begin"/>
				<capture number="4" name="name">
					<subzones>
						<include collection="character-escapes" />
					</subzones>
				</capture>
				<capture number="5" name="punctuation.definition.end"/>
				<capture number="6" name="operator.assignment"/>
			</zone>
			<!--'single'-->
			<zone name="string.quoted.single">
				<starts-with>
					<expression>'</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>'</expression>
					<capture number="0" name="punctuation.definition.end"/>
				</ends-with>
				<subzones>
					<include collection="single-quote-escapes" />
				</subzones>
			</zone>
			<!-- These are the same as a single-quoted string, god help us all -->
			<zone name="string.quoted.single">
				<starts-with>
					<expression>%[qsw]?([~`!@#$%^&amp;*+=|:;'",./?_\\-])</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>\1</expression>
					<capture number="0" name="punctuation.definition.end"/>
				</ends-with>
				<subzones>
					<!--
					Two options: write 22 different syntax zones, each with a single unique escaped character supported.
					
					Or say fuck it, assume that Ruby programmers understand that with these weird-ass strings they only need to escape the delimiter, and do a single blanket rule.
					
					Survey says, option number 2!
					-->
					<zone name="constant.character.escape">
						<expression>(\\)[~`!@#$%^&amp;*+=|:;'",./?_\\-]</expression>
						<capture number="1" name="punctuation.escape.backslash"/>
					</zone>
				</subzones>
			</zone>
			
			<!--"property" : (within object literals)-->
			<zone>
				<expression>(?&lt;=^|,|\{)\s*(((")((?:\\"|[^"])+?)((?&lt;!\\)"))\s*(=>))\s*</expression>
				<capture number="1" name="variable.property.x-assignment"/>
				<capture number="2" name="string.quoted.single"/>
				<capture number="3" name="punctuation.definition.begin"/>
				<capture number="4" name="name">
					<subzones>
						<include collection="interpolated-code" />
						<include collection="character-escapes" />
					</subzones>
				</capture>
				<capture number="5" name="punctuation.definition.end"/>
				<capture number="6" name="operator.assignment"/>
			</zone>
			<!--"double"-->
			<zone name="string.quoted.double">
				<starts-with>
					<expression>"</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>"</expression>
					<capture number="0" name="punctuation.definition.end"/>
				</ends-with>
				<subzones>
					<include collection="interpolated-code" />
					<include collection="character-escapes" />
				</subzones>
			</zone>
			<zone name="string.quoted.double">
				<starts-with>
					<expression>%[QWx]?([~`!@#$%^&amp;*+=|:;'",./?_\\-])</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>\1</expression>
					<capture number="0" name="punctuation.definition.end"/>
				</ends-with>
				<subzones>
					<zone name="constant.character.escape">
						<expression>(\\)[~`!@#$%^&amp;*+=|:;'",./?_\\-]</expression>
						<capture number="1" name="punctuation.escape.backslash"/>
					</zone>
					<include collection="interpolated-code" />
				</subzones>
			</zone>
			
			<!--%q(matched braces)-->
			<!-- Rather than have eight specific zones for each matched brace character with interpolated and non-interpolated versions, we're using 4 unique zones and assuming that people can get over the fact that some of the code inside the string will be incorrectly colored as interpolated ruby -->
			<zone name="string.quoted.braces">
				<starts-with>
					<expression>%[qQswWx]?\(</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>\)</expression>
					<capture number="0" name="punctuation.definition.end"/>
				</ends-with>
				<subzones>
					<include collection="matched-round-escapes" />
				</subzones>
			</zone>
			<zone name="string.quoted.braces">
				<starts-with>
					<expression>%[qQswWx]?\{</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>\}</expression>
					<capture number="0" name="punctuation.definition.end"/>
				</ends-with>
				<subzones>
					<include collection="matched-curly-escapes" />
				</subzones>
			</zone>
			<zone name="string.quoted.braces">
				<starts-with>
					<expression>%[qQswWx]?\[</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>\]</expression>
					<capture number="0" name="punctuation.definition.end"/>
				</ends-with>
				<subzones>
					<include collection="matched-square-escapes" />
				</subzones>
			</zone>
			<zone name="string.quoted.braces">
				<starts-with>
					<expression>%[qQswWx]?&lt;</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>></expression>
					<capture number="0" name="punctuation.definition.end"/>
				</ends-with>
				<subzones>
					<include collection="matched-angle-escapes" />
				</subzones>
			</zone>
			
			<!-- Quoted shell commands -->
			<zone name="string.shell">
				<starts-with>
					<expression>`</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>`</expression>
					<capture number="0" name="punctuation.definition.end"/>
				</ends-with>
				<subzones>
					<zone name="constant.character.escape">
						<expression>(\\)`</expression>
						<capture number="1" name="punctuation.escape.backslash"/>
					</zone>
					<include collection="interpolated-code" />
				</subzones>
			</zone>
			
			<!--heredoc-->
			<zone name="string.heredoc">
				<starts-with>
					<expression>(?&lt;=[=(:,]|^|return)\s*(&lt;{2})("?)(\w+)\2</expression>
					<capture number="0" name="punctuation.definition.begin"/>
					<capture number="3" name="token.identifier" />
				</starts-with>
				<ends-with>
					<expression>^\3$</expression>
					<capture number="0" name="punctuation.definition.end" />
				</ends-with>
				<subzones>
					<include collection="interpolated-code" />
					<include collection="character-escapes" />
				</subzones>
			</zone>
			<zone name="string.heredoc">
				<starts-with>
					<expression>(?&lt;=[=(:,]|^|return)\s*(&lt;{2})-("?)(\w+)\2</expression>
					<capture number="0" name="punctuation.definition.begin"/>
					<capture number="3" name="token.identifier" />
				</starts-with>
				<ends-with>
					<expression>^[ \t]*\3$</expression>
					<capture number="0" name="punctuation.definition.end" />
				</ends-with>
				<subzones>
					<include collection="interpolated-code" />
					<include collection="character-escapes" />
				</subzones>
			</zone>
			<!--single string heredoc-->
			<zone name="string.single.heredoc">
				<starts-with>
					<expression>(?&lt;=[=(:,]|^|return)\s*(&lt;{2})('?)(\w+)\2</expression>
					<capture number="0" name="punctuation.definition.begin"/>
					<capture number="3" name="token.identifier"/>
				</starts-with>
				<ends-with>
					<expression>^\3$</expression>
					<capture number="0" name="punctuation.definition.end" />
				</ends-with>
			</zone>
			<zone name="string.single.heredoc">
				<starts-with>
					<expression>(?&lt;=[=(:,]|^|return)\s*(&lt;{2})-('?)(\w+)\2</expression>
					<capture number="0" name="punctuation.definition.begin"/>
					<capture number="3" name="token.identifier"/>
				</starts-with>
				<ends-with>
					<expression>^[ \t]+\3$</expression>
					<capture number="0" name="punctuation.definition.end" />
				</ends-with>
			</zone>
			<!-- This Sugar does not support multiple heredocs in argument lists. Have you looked at that syntax? It's ugly and impossible to read, much less parse. Don't use it. -->
		</collection>
		
		<!-- String support collections -->
		<collection name="interpolated-code">
			<!--#{ruby-expression}-->
			<zone name="interpolated-code">
				<expression>(#\{)(.*?)(\})</expression>
				<capture number="1" name="punctuation.definition.begin"/>
				<capture number="2" name="expression">
					<subzones>
						<include collection="regex" />
						<include collection="keywords" />
						<include collection="variables" />
						<include collection="punctuation" />
					</subzones>
				</capture>
				<capture number="3" name="punctuation.definition.end"/>
			</zone>
		</collection>
		<collection name="character-escapes">
			<zone name="constant.character.whitespace">
				<expression>(\\)(n|r|t|v|f|s)</expression>
				<capture number="1" name="punctuation.escape.backslash"/>
			</zone>
			<zone name="constant.character.escape">
				<expression>(\\)(x\h{2}|u\h{4}|[0-2][0-7]{,2}|.)</expression>
				<capture number="1" name="punctuation.escape.backslash"/>
			</zone>
		</collection>
		<collection name="single-quote-escapes">
			<zone name="constant.character.escape">
				<expression>(\\)('|\\)</expression>
				<capture number="1" name="punctuation.escape.backslash"/>
			</zone>
		</collection>
		<collection name="matched-round-escapes">
			<zone name="constant.character.escape">
				<expression>(\\)\)</expression>
				<capture number="1" name="punctuation.escape.backslash"/>
			</zone>
			<include collection="interpolated-code" />
			<zone>
				<expression>\((.*?)\)</expression>
				<capture number="1">
					<subzones>
						<include collection="matched-round-escapes" />
					</subzones>
				</capture>
			</zone>
		</collection>
		<collection name="matched-curly-escapes">
			<zone name="constant.character.escape">
				<expression>(\\)\}</expression>
				<capture number="1" name="punctuation.escape.backslash"/>
			</zone>
			<include collection="interpolated-code" />
			<zone>
				<expression>\{(.*?)\}</expression>
				<capture number="1">
					<subzones>
						<include collection="matched-curly-escapes" />
					</subzones>
				</capture>
			</zone>
		</collection>
		<collection name="matched-square-escapes">
			<zone name="constant.character.escape">
				<expression>(\\)\]</expression>
				<capture number="1" name="punctuation.escape.backslash"/>
			</zone>
			<include collection="interpolated-code" />
			<zone>
				<expression>\[(.*?)\]</expression>
				<capture number="1">
					<subzones>
						<include collection="matched-square-escapes" />
					</subzones>
				</capture>
			</zone>
		</collection>
		<collection name="matched-angle-escapes">
			<zone name="constant.character.escape">
				<expression>(\\)></expression>
				<capture number="1" name="punctuation.escape.backslash"/>
			</zone>
			<include collection="interpolated-code" />
			<zone>
				<expression>&lt;(.*?)></expression>
				<capture number="1">
					<subzones>
						<include collection="matched-angle-escapes" />
					</subzones>
				</capture>
			</zone>
		</collection>
		
		<!-- Regex -->
		<collection name="regex">
			<zone name="regex.literal">
				<starts-with>
					<expression>(?&lt;=[=(:,~]|^|return)\s*(/)(?![/*+{}?])</expression>
					<capture number="1" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>(/)([imxo]*)</expression>
					<capture number="1" name="punctuation.definition.end"/>
					<capture number="2" name="regex.flags"/>
				</ends-with>
				<subzones>
					<zone name="constant.character.escape">
						<expression>\\/</expression>
					</zone>
					<include collection="interpolated-code" />
					<include syntax="language-root.regex" />
				</subzones>
			</zone>
			<zone name="regex.literal">
				<starts-with>
					<expression>%r([~`!@#$%^&amp;*+=|:;'",./?_\\-])</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>(\1)([imxo]*)</expression>
					<capture number="1" name="punctuation.definition.end"/>
					<capture number="2" name="regex.flags"/>
				</ends-with>
				<subzones>
					<zone name="constant.character.escape">
						<expression>(\\)[~`!@#$%^&amp;*+=|:;'",./?_\\-]</expression>
						<capture number="1" name="punctuation.escape.backslash"/>
					</zone>
					<include collection="interpolated-code" />
					<include syntax="language-root.regex" />
				</subzones>
			</zone>
			<!--%r(matched braces)-->
			<zone name="regex.literal">
				<starts-with>
					<expression>%r\(</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>(\))([imxo]*)</expression>
					<capture number="1" name="punctuation.definition.end"/>
					<capture number="2" name="regex.flags"/>
				</ends-with>
				<subzones>
					<include collection="matched-round-escapes" />
				</subzones>
			</zone>
			<zone name="regex.literal">
				<starts-with>
					<expression>%r\{</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>(\})([imxo]*)</expression>
					<capture number="1" name="punctuation.definition.end"/>
					<capture number="2" name="regex.flags"/>
				</ends-with>
				<subzones>
					<include collection="matched-curly-escapes" />
				</subzones>
			</zone>
			<zone name="regex.literal">
				<starts-with>
					<expression>%r\[</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>(\])([imxo]*)</expression>
					<capture number="1" name="punctuation.definition.end"/>
					<capture number="2" name="regex.flags"/>
				</ends-with>
				<subzones>
					<include collection="matched-square-escapes" />
				</subzones>
			</zone>
			<zone name="regex.literal">
				<starts-with>
					<expression>%r&lt;</expression>
					<capture number="0" name="punctuation.definition.begin"/>
				</starts-with>
				<ends-with>
					<expression>(>)([imxo]*)</expression>
					<capture number="1" name="punctuation.definition.end"/>
					<capture number="2" name="regex.flags"/>
				</ends-with>
				<subzones>
					<include collection="matched-angle-escapes" />
				</subzones>
			</zone>
		</collection>
		
		<!-- Item Blocks -->
		<collection name="item-blocks">
			<!--
			These must be defined as blocks because Ruby doesn't always have closing delimiters (which makes it impossible to set up hierarchy solely in the itemizers).
			-->
			
			<!-- Functions -->
			
			<zone name="x-item-block">
				<starts-with>
					<expression>\bdef\b</expression>
					<capture number="0" name="keyword.control.x-def"/>
				</starts-with>
				<ends-with>
					<expression>\bend\b</expression>
					<capture number="0" name="keyword.control.delimiter"/>
				</ends-with>
				<subzones>
					<zone name="x-item-start">
						<starts-with>
							<expression>(?&lt;=^def|\sdef)\s+(([^(\s]+)\s*)(\()</expression>
							<capture number="1" name="function.definition"/>
							<capture number="2" name="name"/>
							<capture number="3" name="punctuation.brace.round.open"/>
						</starts-with>
						<ends-with>
							<expression>\)</expression>
							<capture number="0" name="punctuation.brace.round.close"/>
						</ends-with>
						<subzones>
							<zone name="x-item-balanced-braces">
								<starts-with>
									<expression>\(</expression>
									<capture number="0" name="punctuation.brace.round.open"/>
								</starts-with>
								<ends-with>
									<expression>\)</expression>
									<capture number="0" name="punctuation.brace.round.close"/>
								</ends-with>
								<subzones>
									<include syntax="self" />
								</subzones>
							</zone>
							<include syntax="self" />
						</subzones>
					</zone>
					<zone name="x-item-start">
						<expression>(?&lt;=^def|\sdef)\s+(([^(\s]+))</expression>
						<capture number="1" name="function.definition"/>
						<capture number="2" name="name"/>
					</zone>
					<include syntax="self" />
				</subzones>
			</zone>
			
			<!-- Classes and modules -->
			
			<zone name="x-item-block">
				<starts-with>
					<expression>\b(class)\s+([a-zA-Z_][a-zA-Z0-9_]*)(?:\s+(&lt;)\s+([a-zA-Z_][a-zA-Z0-9_:]*))?</expression>
					<capture number="0" name="class.definition"/>
					<capture number="1" name="keyword.control"/>
					<capture number="2" name="name"/>
					<capture number="3" name="punctuation.extends"/>
					<capture number="4" name="variable.parent"/>
				</starts-with>
				<ends-with>
					<expression>\bend\b</expression>
					<capture number="0" name="keyword.control.delimiter"/>
				</ends-with>
				<subzones name="x-item-body">
					<include syntax="self" />
				</subzones>
			</zone>
			<zone name="x-item-block">
				<starts-with>
					<expression>\b(class)\s+(&lt;&lt;)\s+([a-zA-Z_][a-zA-Z0-9_]+)</expression>
					<capture number="0" name="class.definition"/>
					<capture number="1" name="keyword.control"/>
					<capture number="2" name="punctuation.extends"/>
					<capture number="3" name="variable.parent"/>
				</starts-with>
				<ends-with>
					<expression>\bend\b</expression>
					<capture number="0" name="keyword.control.delimiter"/>
				</ends-with>
				<subzones name="x-item-body">
					<include syntax="self" />
				</subzones>
			</zone>
			<zone name="x-item-block">
				<starts-with>
					<expression>\b(module)\s+([a-zA-Z_][a-zA-Z0-9_]*)</expression>
					<capture number="0" name="module.definition"/>
					<capture number="1" name="keyword.control"/>
					<capture number="2" name="name"/>
				</starts-with>
				<ends-with>
					<expression>\bend\b</expression>
					<capture number="0" name="keyword.control.delimiter"/>
				</ends-with>
				<subzones name="x-item-body">
					<include syntax="self" />
				</subzones>
			</zone>
			
			<!-- Generic control blocks -->
			
			<zone name="x-item-block">
				<!-- This fixes single-line do ... end statements (otherwise end is captured by the x-item-start zone) -->
				<expression>\b((do)\s+(.*?))(end)(?=[\n\r]*$)</expression>
				<capture number="1" name="x-item-start"/>
				<capture number="2" name="keyword.control.x-do"/>
				<capture number="3" name="x-item-body">
					<subzones>
						<include syntax="self" />
					</subzones>
				</capture>
				<capture number="4" name="keyword.control.delimiter"/>
			</zone>
			
			<zone name="x-item-block">
				<starts-with>
					<expression>(\b(?:(do)|(begin|case|for|until))\b\s*(.*?))[\n\r]+$</expression>
					<capture number="1" name="x-item-start"/>
					<capture number="2" name="keyword.control" behavior="text-to-name" behavior-transform="x-$0" />
					<capture number="3" name="keyword.control"/>
					<capture number="4" name="parameters">
						<subzones>
							<include collection="comments" />
							<include collection="strings" />
							<include collection="regex" />
							<include collection="keywords" />
							<include collection="variables" />
							<include collection="punctuation" />
						</subzones>
					</capture>
				</starts-with>
				<ends-with>
					<expression>\bend\b</expression>
					<capture number="0" name="keyword.control.delimiter"/>
				</ends-with>
				<subzones name="x-item-body">
					<include syntax="self" />
				</subzones>
			</zone>
			<!-- If, unless, and while can show up in alternate forms inline, so ensure they are starting at the beginning of the line; otherwise similar to above -->
			<zone name="x-item-block">
				<starts-with>
					<expression>^\s*((if|unless|while)\s+(.+?))[\n\r]+$</expression>
					<capture number="1" name="x-item-start"/>
					<capture number="2" name="keyword.control"/>
					<capture number="3" name="parameters">
						<subzones>
							<include collection="comments" />
							<include collection="strings" />
							<include collection="regex" />
							<include collection="keywords" />
							<include collection="variables" />
							<include collection="punctuation" />
						</subzones>
					</capture>
				</starts-with>
				<ends-with>
					<expression>\bend\b</expression>
					<capture number="0" name="keyword.control.delimiter"/>
				</ends-with>
				<subzones name="x-item-body">
					<include syntax="self" />
				</subzones>
			</zone>
		</collection>
		
		<!-- Keywords -->
		<collection name="keywords">
			<!-- Straight keyword definitions -->
			<zone>
				<expression>\b(?:(def|do)|(alias|begin|break|case|class|else|elsif|ensure|for|if|in|include|module|next|redo|rescue|retry|return|then|undef|unless|until|when|while|yield)|(end)|(and|not|or)|(public|private|protected)|(__ENCODING__|__FILE__|__LINE__|BEGIN|END)|(super|self)|(true)|(false)|(nil)|(0[0-7]+|0[xX][0-9a-fA-F]+|0[bB][01]+|(?:(?:[0-9_]+)?\.[0-9]+(?:[eE]-?[0-9]+)?)|(?:[0-9_]+[eE]-?[0-9]+)|[0-9]+(\.{2,3})[0-9]+|[0-9_]+))\b|\b(defined\?)</expression>
				<capture number="1" name="keyword.control" behavior="text-to-name" behavior-transform="x-$0" />
				<capture number="2" name="keyword.control"/>
				<capture number="3" name="keyword.control.delimiter"/>
				<capture number="4" name="keyword.operator.comparison"/>
				<capture number="5" name="keyword.modifier.scope"/>
				<capture number="6" name="keyword.other"/>
				<capture number="7" name="keyword.variable.language"/>
				<capture number="8" name="constant.language.boolean.true"/>
				<capture number="9" name="constant.language.boolean.false"/>
				<capture number="10" name="constant.language.null"/>
				<capture number="11" name="constant.numeric"/>
				<capture number="12" name="operator"/>
				<capture number="13" name="keyword.operator.other"/>
			</zone>
			<!-- FIXME: does it really make sense to cut off syntax parsing after the special __END__ keyword? -->
			<zone name="eof.comment.bookmark">
				<starts-with>
					<expression>__END__</expression>
					<capture number="0" name="keyword.other"/>
				</starts-with>
				<!-- This is a hack, but there's no way to target the last line of a file -->
				<ends-with>__NO_END_IN_SIGHT__</ends-with>
			</zone>
		</collection>
		
		<!-- Variables -->
		<collection name="variables">
			<!--Variable assignment-->
			<!-- We define special zones for variable assignments to allow the itemizers to easily capture arrays and hashes -->
			<zone>
				<expression>\s*(((:)[a-zA-Z_][a-zA-Z0-9_]*)\s*(=>|=(?!=|~)))|(([a-zA-Z_][a-zA-Z0-9_]*)\s*(=))(?!=|~|>)|(([a-zA-Z_][a-zA-Z0-9_.]*)\s*(=))(?!=|~|>)|(\.)([a-zA-Z_][a-zA-Z0-9_]*[?!=]?)\s*(\()|([a-zA-Z_][a-zA-Z0-9_]*[?!=]?)\s*(\()|(\.)([a-zA-Z_][a-zA-Z0-9_]*[?!=]?)|(?&lt;=[=(:,\[\s]|^|return)\s*((:)(?:[A-Za-z0-9_+/\-*=&amp;|@~&lt;>%`]+(?:\[\]|\(\))*[?!=]?|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'))|((@@)[a-zA-Z_][a-zA-Z0-9_]*)|((@)[a-zA-Z_][a-zA-Z0-9_]*)|((\$)(?:.|-[a-zA-Z0-9_]|[a-zA-Z_][a-zA-Z0-9_]*))|([A-Z][a-zA-Z0-9_]*)|([a-zA-Z_][a-zA-Z0-9_]*)</expression>
				<!-- Symbol assignment -->
				<capture number="1" name="variable.symbol.x-assignment"/>
				<capture number="2" name="name"/>
				<capture number="3" name="punctuation"/>
				<capture number="4" name="operator.assignment"/>
				<!-- Normal variable assignment -->
				<capture number="5" name="variable.x-assignment"/>
				<capture number="6" name="name"/>
				<capture number="7" name="operator.assignment"/>
				<!-- Class variable assignment -->
				<capture number="8" name="variable.x-assignment"/>
				<capture number="9" name="accessor-path.name">
					<subzones>
						<include collection="variables" />
					</subzones>
				</capture>
				<capture number="10" name="operator.assignment"/>
				<!-- Method invocation -->
				<!-- FIXME: add more flexible understanding of functions? Ruby can define practically anything as a function, but this is restricting us to standard variable names -->
				<capture number="11" name="punctuation.delimiter.period"/>
				<capture number="12" name="variable.function.method"/>
				<capture number="13" name="punctuation.brace.round.open"/>
				<!-- Function invocation -->
				<capture number="14" name="variable.function"/>
				<capture number="15" name="punctuation.brace.round.open"/>
				<!-- Property accessor -->
				<capture number="16" name="punctuation.delimiter.period"/>
				<capture number="17" name="variable.property"/>
				<!-- Symbols -->
				<capture number="18" name="variable.symbol"/>
				<capture number="19" name="punctuation"/>
				<!-- Class variables -->
				<capture number="20" name="variable.class"/>
				<capture number="21" name="punctuation"/>
				<!-- Instance variable -->
				<capture number="22" name="variable.instance"/>
				<capture number="23" name="punctuation"/>
				<!-- Global variables -->
				<capture number="24" name="variable.global"/>
				<capture number="25" name="punctuation"/>
				<!-- Constants -->
				<capture number="26" name="variable.constant"/>
				<!-- Normal variables (finally) -->
				<capture number="27" name="variable"/>
			</zone>
		</collection>
		
		<!-- Punctuation and operators -->
		<collection name="punctuation">
			<zone>
				<expression>(\+=|-=|\*\*=|\*=|/=|%=|&amp;=|\|\|=|\|=|\^=|>>=|&lt;&lt;=|\+|-|\*\*|\*|/|%|&lt;&lt;|>>|===|==|!=|&lt;=>|&lt;>|>=|>|&lt;=|&lt;|=~|!~|&amp;&amp;|\|\||!|&amp;| \| |\^|~)|(,|:{1,2}|\.|;|\?|\|)|(\\$)|(\()|(\))|(\{)|(\})|(\[)|(\])</expression>
				<capture number="1" name="operator"/>
				<capture number="2" name="punctuation"/>
				<capture number="3" name="punctuation.continuation.backslash"/>
				<capture number="4" name="punctuation.brace.round.open"/>
				<capture number="5" name="punctuation.brace.round.close"/>
				<capture number="6" name="punctuation.brace.curly.open"/>
				<capture number="7" name="punctuation.brace.curly.close"/>
				<capture number="8" name="punctuation.brace.square.open"/>
				<capture number="9" name="punctuation.brace.square.close"/>
			</zone>
		</collection>
		
	</library>
</syntax>
