<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language
[
	<!ENTITY name    "[A-Za-z_:][\w.:_-]*">
	<!ENTITY entref  "&amp;(?:#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
]>
	
<!--
	RHTML syntax highlighting definition for Kate. It combines the ruby and
	html syntax grammars. Some ideas, and the list of Rails method names were 
	taken from an rhtml kate grammar for Quanta based on earlier versions of
	the syntax highlighters.
	
	Copyright (C) 2004  by Sebastian Vuorinen (sebastian dot vuorinen at helsinki dot fi)
	Copyright (C) 2004  by Stefan Lang (langstefan@gmx.at)
	Copyright (C) 2006  by Wilbert Berendsen (wilbert@kde.nl
	Copyright (C) 2005  by Chris Martin (linux@chriscodes.com
	Copyright (C) 2006  by Richard Dale (rdale@foton.es)
	
	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Library General Public
	License as published by the Free Software Foundation; either
	version 2 of the License, or (at your option) any later version.
	
	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Library General Public License for more details.
	
	You should have received a copy of the GNU Library General Public
	License along with this library; if not, write to the
	Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
	Boston, MA  02110-1301, USA.
-->
	
<!--
	TODO:	* Regular expressions spanning over multiple lines
	work only if newlines are escaped.
	* "Nested" HERE documents aren't recognized.
	* Division is detected correctly only, if whitespace
	is around the "/" operator.
	E.g.:	detected correctly:				1 / 2
	"/" interpreted as regex start:		1/2
-->
	
<!-- Hold the "language" opening tag on a single line, as mentioned in "language.dtd". -->
<language name="Ruby/Rails/RHTML" version="14" kateversion="5.63" section="Markup" extensions="*.rhtml;*.RHTML;*.html.erb" mimetype="" author="Richard Dale rdale@foton.es" license="LGPLv2+">
	
	<highlighting>
	
		<list name="keywords">
			<item>BEGIN</item>
			<item>END</item>
			<item>and</item>
			<item>begin</item>
			<item>break</item>
			<item>case</item>
			<item>defined?</item>
			<item>do</item>
			<item>else</item>
			<item>elsif</item>
			<item>end</item>
			<item>ensure</item>
			<item>for</item>
			<item>if</item>
			<item>in</item>
			<item>include</item>
			<item>next</item>
			<item>not</item>
			<item>or</item>
			<item>redo</item>
			<item>rescue</item>
			<item>retry</item>
			<item>return</item>
			<item>then</item>
			<item>unless</item>
			<item>until</item>
			<item>when</item>
			<item>while</item>
			<item>yield</item>
		</list>
		
		<list name="access-control">
			<item>private_class_method</item>
			<item>private</item>
			<item>protected</item>
			<item>public_class_method</item>
			<item>public</item>
		</list>

		<list name="attribute-definitions">
			<item>attr_reader</item>
			<item>attr_writer</item>
			<item>attr_accessor</item>
		</list>
		
		<list name="definitions">
			<item>alias</item>
			<item>module</item>
			<item>class</item>
			<item>def</item>
			<item>undef</item>
		</list>
		
		<list name="pseudo-variables">
			<item>self</item>
			<item>super</item>
			<item>nil</item>
			<item>false</item>
			<item>true</item>
			<item>caller</item>
			<item>__FILE__</item>
			<item>__LINE__</item>
		</list>
		
		<list name="default-globals">
			<item>$stdout</item>
			<item>$defout</item>
			<item>$stderr</item>
			<item>$deferr</item>
			<item>$stdin</item>
		</list>
		
		<!-- Kernel module methods.
			NOTE: Methods ending in ? or !
				are included below as regexes.
		-->
		<list name="kernel-methods">
			<!-- backquote ` -->
			<item>abort</item>
			<item>at_exit</item>
			<item>autoload</item>
			<item>autoload?</item>
			<item>binding</item>
			<item>block_given?</item>
			<item>callcc</item>
			<item>caller</item>
			<item>catch</item>
			<item>chomp</item>
			<item>chomp!</item>
			<item>chop</item>
			<item>chop!</item>
			<item>eval</item>
			<item>exec</item>
			<item>exit</item>
			<item>exit!</item>
			<item>fail</item>
			<item>fork</item>
			<item>format</item>
			<item>getc</item>
			<item>gets</item>
			<item>global_variables</item>
			<item>gsub</item>
			<item>gsub!</item>
			<item>iterator?</item>
			<item>lambda</item>
			<item>load</item>
			<item>local_variables</item>
			<item>loop</item>
			<item>method_missing</item>
			<item>open</item>
			<item>p</item>
			<item>print</item>
			<item>printf</item>
			<item>proc</item>
			<item>putc</item>
			<item>puts</item>
			<item>raise</item>
			<item>rand</item>
			<item>readline</item>
			<item>readlines</item>
			<item>require</item>
			<item>scan</item>
			<item>select</item>
			<item>set_trace_func</item>
			<item>sleep</item>
			<item>split</item>
			<item>sprintf</item>
			<item>srand</item>
			<item>sub</item>
			<item>sub!</item>
			<item>syscall</item>
			<item>system</item>
			<item>test</item>
			<item>throw</item>
			<item>trace_var</item>
			<item>trap</item>
			<item>untrace_var</item>
			<item>warn</item>
			
			<!-- ActionView methods from Rails docs -->
			<item>auto_complete_field</item>
			<item>auto_complete_result</item>
			<item>auto_discovery_link_tag</item>
			<item>auto_link</item>
			<item>benchmark</item>
			<item>button_to</item>
			<item>cache</item>
			<item>capture</item>
			<item>check_box</item>
			<item>check_box_tag</item>
			<item>collection_select</item>
			<item>concat</item>
			<item>content_for</item>
			<item>content_tag</item>
			<item>country_options_for_select</item>
			<item>country_select</item>
			<item>current_page?</item>
			<item>date_select</item>
			<item>datetime_select</item>
			<item>debug</item>
			<item>define_javascript_functions</item>
			<item>distance_of_time_in_words</item>
			<item>distance_of_time_in_words_to_now</item>
			<item>draggable_element</item>
			<item>drop_receiving_element</item>
			<item>end_form_tag</item>
			<item>error_message_on</item>
			<item>error_messages_for</item>
			<item>escape_javascript</item>
			<item>evaluate_remote_response</item>
			<item>excerpt</item>
			<item>file_field</item>
			<item>file_field_tag</item>
			<item>finish_upload_status</item>
			<item>form</item>
			<item>form_remote_tag</item>
			<item>form_tag</item>
			<item>form_tag_with_upload_progress</item>
			<item>h</item>
			<item>hidden_field</item>
			<item>hidden_field_tag</item>
			<item>highlight</item>
			<item>human_size</item>
			<item>image_path</item>
			<item>image_submit_tag</item>
			<item>image_tag</item>
			<item>input</item>
			<item>javascript_include_tag</item>
			<item>javascript_path</item>
			<item>javascript_tag</item>
			<item>link_image_to</item>
			<item>link_to</item>
			<item>link_to_function</item>
			<item>link_to_if</item>
			<item>link_to_image</item>
			<item>link_to_remote</item>
			<item>link_to_unless</item>
			<item>link_to_unless_current</item>
			<item>mail_to</item>
			<item>markdown</item>
			<item>number_to_currency</item>
			<item>number_to_human_size</item>
			<item>number_to_percentage</item>
			<item>number_to_phone</item>
			<item>number_with_delimiter</item>
			<item>number_with_precision</item>
			<item>observe_field</item>
			<item>observe_form</item>
			<item>option_groups_from_collection_for_select</item>
			<item>options_for_select</item>
			<item>options_from_collection_for_select</item>
			<item>pagination_links</item>
			<item>password_field</item>
			<item>password_field_tag</item>
			<item>periodically_call_remote</item>
			<item>pluralize</item>
			<item>radio_button</item>
			<item>radio_button_tag</item>
			<item>register_template_handler</item>
			<item>render</item>
			<item>render_file</item>
			<item>render_template</item>
			<item>sanitize</item>
			<item>select</item>
			<item>select_date</item>
			<item>select_datetime</item>
			<item>select_day</item>
			<item>select_hour</item>
			<item>select_minute</item>
			<item>select_month</item>
			<item>select_second</item>
			<item>select_tag</item>
			<item>select_time</item>
			<item>select_year</item>
			<item>simple_format</item>
			<item>sortable_element</item>
			<item>start_form_tag</item>
			<item>strip_links</item>
			<item>stylesheet_link_tag</item>
			<item>stylesheet_path</item>
			<item>submit_tag</item>
			<item>submit_to_remote</item>
			<item>tag</item>
			<item>text_area</item>
			<item>text_area_tag</item>
			<item>text_field</item>
			<item>text_field_tag</item>
			<item>text_field_with_auto_complete</item>
			<item>textilize</item>
			<item>textilize_without_paragraph</item>
			<item>time_ago_in_words</item>
			<item>time_zone_options_for_select</item>
			<item>time_zone_select</item>
			<item>truncate</item>
			<item>update_element_function</item>
			<item>upload_progress_status</item>
			<item>upload_progress_text</item>
			<item>upload_progress_update_bar_js</item>
			<item>upload_status_progress_bar_tag</item>
			<item>upload_status_tag</item>
			<item>upload_status_text_tag</item>
			<item>url_for</item>
			<item>visual_effect</item>
			<item>word_wrap</item>
		</list>
		
		<contexts>
			
		<!-- BEGIN HTML contexts -->
			<context name="Start" attribute="Normal Text" lineEndContext="#stay">
				<IncludeRules context="FindHTML" />
			</context>
			
			<context name="FindHTML" attribute="Normal Text" lineEndContext="#stay">
				<DetectSpaces/>
				<DetectIdentifier/>
				
				<IncludeRules context="find-rubysource" />
				<DetectChar attribute="Ruby Source" context="rubysourceline" char="%" />
				
				<StringDetect attribute="Comment" context="Comment" String="&lt;!--" beginRegion="comment" />
				<StringDetect attribute="CDATA" context="CDATA" String="&lt;![CDATA[" beginRegion="cdata" />
				<RegExpr attribute="Doctype" context="Doctype" String="&lt;!DOCTYPE\s+" beginRegion="doctype" />
				<RegExpr attribute="Processing Instruction" context="PI" String="&lt;\?[\w:-]*" beginRegion="pi" />
				<WordDetect attribute="Element" context="CSS" String="&lt;style" insensitive="true" beginRegion="style" />
				<WordDetect attribute="Element" context="JS" String="&lt;script" insensitive="true" beginRegion="script" />
				<WordDetect attribute="Element" context="El Open" String="&lt;pre" insensitive="true" beginRegion="pre" />
				<WordDetect attribute="Element" context="El Open" String="&lt;div" insensitive="true" beginRegion="div" />
				<WordDetect attribute="Element" context="El Open" String="&lt;table" insensitive="true" beginRegion="table" />
				<RegExpr attribute="Element" context="El Open" String="&lt;&name;" />
				<WordDetect attribute="Element" context="El Close" String="&lt;/pre" insensitive="true" endRegion="pre" />
				<WordDetect attribute="Element" context="El Close" String="&lt;/div" insensitive="true" endRegion="div" />
				<WordDetect attribute="Element" context="El Close" String="&lt;/table" insensitive="true" endRegion="table" />
				<RegExpr attribute="Element" context="El Close" String="&lt;/&name;" />
				<!-- as long as kde gives DTDs the text/html mimetype--><IncludeRules context="FindDTDRules" />
				<IncludeRules context="FindEntityRefs" />
			</context>
			
			<context name="FindEntityRefs" attribute="Normal Text" lineEndContext="#stay">
				<RegExpr attribute="EntityRef" context="#stay" String="&entref;" />
				<AnyChar attribute="Error" context="#stay" String="&amp;&lt;" />
			</context>
			
			<context name="FindPEntityRefs" attribute="Normal Text" lineEndContext="#stay">
				<RegExpr attribute="EntityRef" context="#stay" String="&entref;" />
				<RegExpr attribute="PEntityRef" context="#stay" String="%&name;;" />
				<AnyChar attribute="Error" context="#stay" String="&amp;%" />
			</context>
			
			<context name="FindAttributes" attribute="Normal Text" lineEndContext="#stay">
				<RegExpr attribute="Attribute" context="#stay" String="^&name;|\s+&name;" />
				<DetectChar attribute="Attribute" context="Value" char="=" />
			</context>
			
			<context name="FindDTDRules" attribute="Normal Text" lineEndContext="#stay">
				<RegExpr attribute="Doctype" context="Doctype Markupdecl" String="&lt;!(?:ELEMENT|ENTITY|ATTLIST|NOTATION)\b" />
			</context>
			
			
			<context name="Comment" attribute="Comment" lineEndContext="#stay">
				<DetectSpaces/>
				<StringDetect attribute="Comment" context="#pop" String="--&gt;" endRegion="comment" />
				<IncludeRules context="##Comments" />
				<DetectIdentifier/>
				<RegExpr attribute="Error" context="#stay" String="-(-(?!-&gt;))+" />
			</context>
			
			<context name="CDATA" attribute="Normal Text" lineEndContext="#stay">
				<DetectSpaces/>
				<DetectIdentifier/>
				<StringDetect attribute="CDATA" context="#pop" String="]]&gt;" endRegion="cdata" />
				<StringDetect attribute="EntityRef" context="#stay" String="]]&amp;gt;" />
			</context>
			
			<context name="PI" attribute="Normal Text" lineEndContext="#stay">
				<Detect2Chars attribute="Processing Instruction" context="#pop" char="?" char1="&gt;" endRegion="pi" />
			</context>
			
			<context name="Doctype" attribute="Normal Text" lineEndContext="#stay">
				<DetectChar attribute="Doctype" context="#pop" char="&gt;" endRegion="doctype" />
				<DetectChar attribute="Doctype" context="Doctype Internal Subset" char="[" beginRegion="int_subset" />
			</context>
			
			<context name="Doctype Internal Subset" attribute="Normal Text" lineEndContext="#stay">
				<DetectChar attribute="Doctype" context="#pop" char="]" endRegion="int_subset" />
				<IncludeRules context="FindDTDRules" />
				<StringDetect attribute="Comment" context="Comment" String="&lt;!--" beginRegion="comment" />
				<RegExpr attribute="Processing Instruction" context="PI" String="&lt;\?[\w:-]*" beginRegion="pi" />
				<IncludeRules context="FindPEntityRefs" />
			</context>
			
			<context name="Doctype Markupdecl" attribute="Normal Text" lineEndContext="#stay">
				<DetectChar attribute="Doctype" context="#pop" char="&gt;" />
				<DetectChar attribute="Value" context="Doctype Markupdecl DQ" char="&quot;" />
				<DetectChar attribute="Value" context="Doctype Markupdecl SQ" char="&apos;" />
			</context>
			
			<context name="Doctype Markupdecl DQ" attribute="Value" lineEndContext="#stay">
				<IncludeRules context="find-rubysource" />
				
				<DetectChar attribute="Value" context="#pop" char="&quot;" />
				<IncludeRules context="FindPEntityRefs" />
			</context>
			
			<context name="Doctype Markupdecl SQ" attribute="Value" lineEndContext="#stay">
				<IncludeRules context="find-rubysource" />
				
				<DetectChar attribute="Value" context="#pop" char="&apos;" />
				<IncludeRules context="FindPEntityRefs" />
			</context>
			
			<context name="El Open" attribute="Normal Text" lineEndContext="#stay">
				<IncludeRules context="find-rubysource" />
				
				<Detect2Chars attribute="Element" context="#pop" char="/" char1="&gt;" />
				<DetectChar attribute="Element" context="#pop" char="&gt;" />
				<IncludeRules context="FindAttributes" />
				<RegExpr attribute="Error" context="#stay" String="\S" />
			</context>
			
			<context name="El Close" attribute="Normal Text" lineEndContext="#stay">
				<IncludeRules context="find-rubysource" />
				
				<DetectChar attribute="Element" context="#pop" char="&gt;" />
				<RegExpr attribute="Error" context="#stay" String="\S" />
			</context>
			
			<context name="El Close 2" attribute="Normal Text" lineEndContext="#stay">
				<IncludeRules context="find-rubysource" />
				
				<DetectChar attribute="Element" context="#pop#pop#pop" char="&gt;" />
				<RegExpr attribute="Error" context="#stay" String="\S" />
			</context>
			
			<context name="El Close 3" attribute="Normal Text" lineEndContext="#stay">
				<IncludeRules context="find-rubysource" />
				
				<DetectChar attribute="Element" context="#pop#pop#pop#pop" char="&gt;" />
				<RegExpr attribute="Error" context="#stay" String="\S" />
			</context>
			
			<context name="CSS" attribute="Normal Text" lineEndContext="#stay">
				<IncludeRules context="find-rubysource" />
				
				<Detect2Chars attribute="Element" context="#pop" char="/" char1="&gt;" endRegion="style" />
				<DetectChar attribute="Element" context="CSS content" char="&gt;" />
				<IncludeRules context="FindAttributes" />
				<RegExpr attribute="Error" context="#stay" String="\S" />
			</context>
			
			<context name="CSS content" attribute="Normal Text" lineEndContext="#stay">
				<IncludeRules context="find-rubysource" />
				
				<WordDetect attribute="Element" context="El Close 2" String="&lt;/style" insensitive="true" endRegion="style" />
				<IncludeRules context="##CSS" includeAttrib="true"/>
			</context>
			
			<context name="JS" attribute="Normal Text" lineEndContext="#stay">
				<IncludeRules context="find-rubysource" />
				
				<Detect2Chars attribute="Element" context="#pop" char="/" char1="&gt;" endRegion="script" />
				<DetectChar attribute="Element" context="JS content" char="&gt;" />
				<IncludeRules context="FindAttributes" />
				<RegExpr attribute="Error" context="#stay" String="\S" />
			</context>
			
			<context name="JS content" attribute="Normal Text" lineEndContext="#stay">
				<IncludeRules context="find-rubysource" />
				
				<WordDetect attribute="Element" context="El Close 2" String="&lt;/script" insensitive="true" endRegion="script" />
				<RegExpr attribute="Comment" context="JS comment close" String="//(?=.*&lt;/script\b)" insensitive="true" />
				<IncludeRules context="Normal##JavaScript" includeAttrib="true"/>
			</context>
			
			<context name="JS comment close" attribute="Comment" lineEndContext="#pop">
				<RegExpr attribute="Element" context="El Close 3" String="&lt;/script\b" insensitive="true" endRegion="script" />
				<IncludeRules context="##Comments" />
			</context>
			
			<context name="Value" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="Value NQ">
				<IncludeRules context="find-rubysource" />
				
				<DetectChar attribute="Value" context="Value DQ" char="&quot;" />
				<DetectChar attribute="Value" context="Value SQ" char="&apos;" />
				<DetectSpaces />
			</context>
			
			<context name="Value NQ" attribute="Normal Text" lineEndContext="#pop#pop" fallthroughContext="#pop#pop">
				<IncludeRules context="find-rubysource" />
				
				<IncludeRules context="FindEntityRefs" />
				<RegExpr attribute="Value" context="#stay" String="/(?!&gt;)|[^/&gt;&lt;&quot;&apos;\s]" />
			</context>
			
			<context name="Value DQ" attribute="Value" lineEndContext="#stay">
				<IncludeRules context="find-rubysource" />
				
				<DetectChar attribute="Value" context="#pop#pop" char="&quot;" />
				<IncludeRules context="FindEntityRefs" />
			</context>
			
			<context name="Value SQ" attribute="Value" lineEndContext="#stay">
				<IncludeRules context="find-rubysource" />
				
				<DetectChar attribute="Value" context="#pop#pop" char="&apos;" />
				<IncludeRules context="FindEntityRefs" />
  			</context>	
		<!-- END HTML contexts -->
		
		<!-- BEGIN Ruby contexts -->
		
			<!-- A single line of ruby source after a '%' ERB tag -->
			<context name="rubysourceline" attribute="RUBY RAILS ERB Text" lineEndContext="#pop">
				<IncludeRules context="rubysource" />
			</context>
			
			<context name="find-rubysource" attribute="Normal Text" lineEndContext="#stay">
				<Detect2Chars attribute="Ruby Source" context="rubysource-markup" char="&lt;" char1="%" />
			</context>
			<context name="rubysource-markup" attribute="Ruby Source" lineEndContext="#pop!rubysource-block-content" fallthroughContext="#pop!rubysource-block-content">
				<AnyChar attribute="Ruby Source" context="#pop!rubysource-block-content" String="=-" /> <!-- <%= and <%- -->
			</context>
			<context name="rubysource-block-content" attribute="RUBY RAILS ERB Text" lineEndContext="#stay">
				<StringDetect attribute="Ruby Source" context="#pop" String="-%&gt;" />
				<Detect2Chars attribute="Ruby Source" context="#pop" char="%" char1="&gt;" />
				<IncludeRules context="rubysource" />
			</context>

			<context name="rubysource" attribute="RUBY RAILS ERB Text" lineEndContext="#stay">
				<!-- ruby ignores newline after \ -->
				<LineContinue attribute="Ruby Normal Text" context="Line Continue"/>

				<!-- __END__ token on own line. -->
				<RegExpr attribute="Keyword" String="^__END__$" context="DATA" column="0"/>
				
				<!-- "shebang" line -->
				<StringDetect attribute="Keyword" String="^#!/" context="ShebangLine" column="0"/>
				
				<!-- "def" - "end" blocks -->
				<!-- check for statement modifiers with regexes -->
				<RegExpr attribute="Keyword" String="(?:\=|\(|\[|\{)\s*(?:if|unless|while|until)\b" context="#stay" beginRegion="def block"/>
				<RegExpr attribute="Keyword" String="(while|until)\b(?!.*\bdo\b)" context="#stay" beginRegion="def block" firstNonSpace="true"/>
				<RegExpr attribute="Keyword" String="\;\s*(?:while|until)\b(?!.*\bdo\b)" context="#stay" beginRegion="def block"/>
				<WordDetect attribute="Keyword" String="if" context="#stay" beginRegion="def block" firstNonSpace="true"/>
				<WordDetect attribute="Keyword" String="unless" context="#stay" beginRegion="def block" firstNonSpace="true"/>
				<RegExpr attribute="Keyword" String="\;\s*(?:if|unless)\b" context="#stay" beginRegion="def block"/>
				<WordDetect attribute="Keyword" String="class" context="#stay" beginRegion="def block"/>
				<WordDetect attribute="Keyword" String="module" context="#stay" beginRegion="def block"/>
				<WordDetect attribute="Keyword" String="begin" context="#stay" beginRegion="def block"/>
				<RegExpr attribute="Keyword" String="\bfor\b(?!.*\bdo\b)" context="#stay" beginRegion="def block"/>
				<WordDetect attribute="Keyword" String="case" context="#stay" beginRegion="def block"/>
				<WordDetect attribute="Keyword" String="do" context="#stay" beginRegion="def block"/>
				<WordDetect attribute="Keyword" String="def" context="#stay" beginRegion="def block"/>
				<WordDetect attribute="Keyword" String="end" context="#stay" endRegion="def block"/>
				<!-- elsif/else close the current block and start a new one -->
				<RegExpr attribute="Keyword" String="(?:\b|^\s*)(?:else|elsif|rescue|ensure)(?:\s+|$)" context="#stay" endRegion="def block" beginRegion="def block"/>
				
				<StringDetect attribute="Operator" String="..." context="#stay"/>
				<Detect2Chars attribute="Operator" char="." char1="." context="#stay"/>
				
				<!-- marks a message (being sent, not defined) -->
				<RegExpr attribute="Message" String="\.[_a-z][_a-zA-Z0-9]*(?:\?|\!|\b)" context="#stay"/>
				
				<!-- Check for "ASCII code operator". e.g.: ?a -->
				<RegExpr attribute="Dec" String="\s\?(?:\\M\-)?(?:\\C\-)?\\?\S" context="#stay"/>
				
				<keyword attribute="Keyword" String="keywords" context="#stay"/>
				<keyword attribute="Attribute Definition" String="attribute-definitions"  context="#stay"/>
				<keyword attribute="Access Control" String="access-control" context="#stay"/>
				<keyword attribute="Definition" String="definitions"  context="#stay" />
				<keyword attribute="Pseudo variable" String="pseudo-variables"  context="#stay"/>
				<keyword attribute="Default globals" String="default-globals" context="#stay"/>
				<keyword attribute="Kernel methods" String="kernel-methods" context="#stay"/>
				
				<!-- (global) vars starting with $
					Match them before $_.
					-->
				<RegExpr attribute="Global Variable" String="\$(?:\w+|\-[a-zA-Z_]\b)" context="#stay"/>
				<!-- special-character globals -->
				<RegExpr attribute="Default globals" String="\$[\d_*`\!:?'/\\\-\&amp;]" context="#stay"/>
				<RegExpr attribute="Global Constant" String="\b[_A-Z]+[A-Z_0-9]+\b" context="#stay"/>
				<!-- Generally a module or class name like "File", "MyModule_1", .. -->
				<RegExpr attribute="Constant" String="\b[A-Z]+_*(?:[0-9]|[a-z])[_a-zA-Z0-9]*\b" context="#stay"/>
				
				<RegExpr attribute="Hex" String="(?:\-|\b)0[xX][_0-9a-fA-F]+" context="#stay"/>
				<RegExpr attribute="Bin" String="(?:\-|\b)0[bB][_01]+" context="#stay"/>
				<RegExpr attribute="Octal" String="(?:\-|\b)0[1-7][_0-7]*" context="#stay"/>
				<RegExpr attribute="Float" String="(?:\-|\b)[0-9][0-9_]*\.[0-9][0-9_]*(?:[eE]\-?[1-9][0-9]*(?:\.[0-9]*)?)?" context="#stay"/>
				<RegExpr attribute="Dec" String="(?:\-|\b)[1-9][0-9_]*\b" context="#stay"/>
				<Int attribute="Dec" context="#stay"/>
				<HlCChar attribute="Char" context="#stay"/>
				
				<!-- Check for =begin before assignment operator. -->
				<StringDetect attribute="Blockcomment" String="=begin" context="Embedded documentation" beginRegion="comment block" column="0"/>
				
				<!-- recognize the beginning of a HEREDOC
					This uses new features in Kate 2.3 and later
					
					There is no other chance of keeping heredoc apart from the
					push operator '<<' than requiring to put space between the operator
										and the string.
										-->
				<RegExpr attribute="Operator" context="find_indented_heredoc" String="\s*&lt;&lt;-(?=\w+|[&quot;'])" beginRegion="HereDocument" />
				<RegExpr attribute="Operator" context="find_heredoc" String="\s*&lt;&lt;(?=\w+|[&quot;'])" beginRegion="HereDocument" />
				
				<DetectChar attribute="Operator" char="." context="#stay"/>
				<Detect2Chars attribute="Operator" char="&amp;" char1="&amp;" context="#stay"/>
				<Detect2Chars attribute="Operator" char="|" char1="|" context="#stay"/>
				<!-- \s! is regexp hack -->
				<RegExpr attribute="Operator" String="\s[\?\:\%/]\s|[|&amp;&lt;&gt;\^\+*~\-=]+|\s!|/=\s" context="#stay"/>
				<Detect2Chars attribute="Operator" char="%" char1="=" context="#stay"/>
				<Detect2Chars attribute="Operator" char=":" char1=":" context="Member Access"/>
				
				<RegExpr attribute="Symbol" String=":[a-zA-Z_][a-zA-Z0-9_]*" context="#stay"/>
				
				<DetectChar attribute="String" char="&quot;" context="Quoted String"/>
				<DetectChar attribute="Raw String" char="'" context="Apostrophed String"/>
				<DetectChar attribute="Command" char="`" context="Command String"/>
				
				<Detect2Chars attribute="Normal Text" char="?" char1="#" context="#stay"/>
				
				<RegExpr attribute="Comment" String="^#\s*BEGIN.*$"  context="#stay" beginRegion="marker" column="0"/>
				<RegExpr attribute="Comment" String="^#\s*END.*$"  context="#stay" endRegion="marker" column="0"/>
				<DetectChar attribute="Comment" char="#"  context="Comment Line" firstNonSpace="true"/>
				<RegExpr attribute="Comment" String="\s#"  context="General Comment"/>
				
				<RegExpr attribute="Delimiter" String="[\[\]]+"  context="#stay"/>
				<DetectChar attribute="Delimiter" char="{" context="#stay" beginRegion="def block"/>
				<DetectChar attribute="Delimiter" char="}" context="#stay" endRegion="def block"/>
				
				<RegExpr attribute="Instance Variable" String="@[a-zA-Z_0-9]+" context="#stay"/>
				<RegExpr attribute="Class Variable" String="@@[a-zA-Z_0-9]+" context="#stay"/>
				
				<!-- handle the different regular expression formats -->
				<DetectChar attribute="Regular Expression" char="/" context="RegEx 1"/>
				
				<!-- recognize the beginning of a general delimited input format -->
				<!-- this moves to the next context to separate out the exact nature of the GDL input -->
				<RegExpr attribute="GDL input" context="find_gdl_input" String="\s*[%](?=[Qqxw]?[^\s&gt;])" beginRegion="GdlInput" />
			</context>

			<context name="ShebangLine" attribute="Keyword" lineEndContext="#pop" />
			
			<context name="Line Continue" attribute="Ruby Normal Text" lineEndContext="#pop">
				<RegExpr attribute="Keyword" String="(?:while|until)\b(?!.*\bdo\b)" context="#stay" firstNonSpace="true"/>
				<WordDetect attribute="Keyword" String="if" context="#stay" firstNonSpace="true"/>
				<WordDetect attribute="Keyword" String="unless" context="#stay" firstNonSpace="true"/>
				<IncludeRules context="rubysource"/>
			</context>
			
			<context name="Quoted String" attribute="String" lineEndContext="#stay">
				<Detect2Chars attribute="String" char="\" char1="\" context="#stay"/>
				<Detect2Chars attribute="String" char="\" char1="&quot;" context="#stay"/>
				<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
				<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
				<!--HlCChar attribute="Char" context="#pop"/-->
				<DetectChar char="&quot;" attribute="String" context="#pop"/>
			</context>
			
			<context name="Apostrophed String" attribute="Raw String" lineEndContext="#stay">
				<!-- <HlCChar attribute="Char" context="#pop"/> -->
				<Detect2Chars attribute="String" char="\" char1="\" context="#stay"/>
				<Detect2Chars attribute="String" char="\" char1="'" context="#stay"/>
				<DetectChar char="'" attribute="Raw String" context="#pop"/>
			</context>
			
			<context name="Command String" attribute="Command" lineEndContext="#stay">
				<Detect2Chars attribute="String" char="\" char1="\" context="#stay"/>
				<Detect2Chars attribute="String" char="\" char1="`" context="#stay"/>
				<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
				<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
				<HlCChar attribute="Char" context="#pop"/>
				<DetectChar char="`" attribute="Command" context="#pop"/>
			</context>
			
			<context name="Embedded documentation" attribute="Ruby Comment" lineEndContext="#stay">
				<StringDetect attribute="Ruby Comment" String="=end" context="#pop" endRegion="comment block" column="0"/>
			</context>
			
			<context name="RegEx 1" attribute="Regular Expression" lineEndContext="#stay">
				<Detect2Chars attribute="Regular Expression" char="\" char1="/" context="#stay"/>
				<RegExpr attribute="Regular Expression" String="[^\\]$" context="#pop"/>
				<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
				<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
				<RegExpr attribute="Regular Expression" String="/[uiomxn]*" context="#pop"/>
			</context>
			
			<!-- Substitutions can be nested -->
			<context name="Subst" attribute="Ruby Normal Text" lineEndContext="#stay">
				<DetectChar attribute="Substitution" char="}" context="#pop"/>
				<!-- Highlight substitution as code. -->
				<IncludeRules context="rubysource"/>
			</context>
			
			<context name="Short Subst" attribute="Substitution" lineEndContext="#pop">
				<!-- Check for e.g.: "#@var#@@xy" -->
				<RegExpr attribute="Substitution" String="#@{1,2}" context="#stay"/>
				<RegExpr attribute="Substitution" String="\w(?!\w)" context="#pop"/>
			</context>
			
			<!-- This handles access of nested module classes and class methods -->
			<context name="Member Access" attribute="Member" lineEndContext="#pop">
				<!-- marks a message (being sent, not defined) -->
				<RegExpr attribute="Message" String="\.?[_a-z]\w*[\?\!]?(?=[^\w\d\.\:])" context="#pop"/>
				<RegExpr attribute="Message" String="\.?[_a-z]\w*[\?\!]?" context="#stay"/>
				<RegExpr attribute="Constant" String="[A-Z]+_*[\da-z]\w*(?=[^\w\d\.\:])" context="#pop"/>
				<RegExpr attribute="Constant" String="[A-Z]+_*[0-9a-z]\w*" context="#stay"/>
				<RegExpr attribute="Constant Value" String="[_A-Z][_A-Z0-9]*(?=[^\w\d\.\:])" context="#pop"/>
				<RegExpr attribute="Constant Value" String="[_A-Z][_A-Z0-9]*" context="#stay"/>
				<Detect2Chars attribute="Operator" char=":" char1=":" context="#stay"/>
				<DetectChar attribute="Member" char="." context="#stay"/>
				
				<AnyChar attribute="Operator" String="=+-*/%|&amp;[]{}~" context="#pop"/>
				<DetectChar attribute="Ruby Comment" char="#" context="#pop"/>
				<AnyChar attribute="Ruby Normal Text" String="()\" context="#pop"/>
				<RegExpr attribute="Member" String="\W" context="#pop"/>
			</context>
			
			<context name="Comment Line" attribute="Ruby Comment" lineEndContext="#pop">
				<DetectSpaces />
				<StringDetect context="#pop" String="-%&gt;" lookAhead="true" />
				<Detect2Chars context="#pop" char="%" char1="&gt;" lookAhead="true" />
				<RegExpr attribute="Ruby Comment" String="\w\:\:\s" context="RDoc Label"/>
				<IncludeRules context="##Comments"/>
			</context>
			
			<context name="General Comment" attribute="Ruby Comment" lineEndContext="#pop">
				<DetectSpaces/>
				<IncludeRules context="##Comments"/>
			</context>
			
			<context name="RDoc Label" attribute="RDoc Value" lineEndContext="#pop"/>
			
			<!-- HEREDOC support
				The contexts below support both normal and indented heredocs
				-->
			<!-- here we markup the heredoc markers -->
			<context name="find_heredoc" attribute="Ruby Normal Text" lineEndContext="#pop" >
				<RegExpr attribute="Keyword" context="apostrophed_normal_heredoc" String="'(\w+)'" />
				<RegExpr attribute="Keyword" context="normal_heredoc" String="&quot;?(\w+)&quot;?" />
			</context>
			<context name="find_indented_heredoc" attribute="Ruby Normal Text" lineEndContext="#pop" >
				<RegExpr attribute="Keyword" context="apostrophed_indented_heredoc" String="'(\w+)'" />
				<RegExpr attribute="Keyword" context="indented_heredoc" String="&quot;?(\w+)&quot;?" />
			</context>
			<!-- these are the real heredoc contexts -->
			<context name="indented_heredoc" attribute="Ruby Normal Text" lineEndContext="#stay" dynamic="true">
				<!--				<RegExpr attribute="Keyword" context="#pop#pop" String="^\s*%1$" dynamic="true" endRegion="HereDocument"/>-->
				<RegExpr attribute="Keyword" context="#pop#pop" String="%1$" dynamic="true" endRegion="HereDocument" firstNonSpace="true"/>
				<IncludeRules context="heredoc_rules" />
			</context>
			<context name="apostrophed_indented_heredoc" attribute="Ruby Normal Text" lineEndContext="#stay" dynamic="true">
				<!--				<RegExpr attribute="Keyword" context="#pop#pop" String="^\s*%1$" dynamic="true" endRegion="HereDocument"/>-->
				<RegExpr attribute="Keyword" context="#pop#pop" String="%1$" dynamic="true" endRegion="HereDocument" firstNonSpace="true"/>
			</context>
			
			<context name="normal_heredoc" attribute="Ruby Normal Text" lineEndContext="#stay" dynamic="true">
				<!--				<RegExpr attribute="Keyword" context="#pop#pop" String="^%1$" dynamic="true" endRegion="HereDocument"/>-->
				<RegExpr attribute="Keyword" context="#pop#pop" String="^%1$" dynamic="true" endRegion="HereDocument" column="0"/>
				<IncludeRules context="heredoc_rules" />
			</context>
			<context name="apostrophed_normal_heredoc" attribute="Ruby Normal Text" lineEndContext="#stay" dynamic="true">
				<!--				<RegExpr attribute="Keyword" context="#pop#pop" String="^%1$" dynamic="true" endRegion="HereDocument"/>-->
				<RegExpr attribute="Keyword" context="#pop#pop" String="^%1$" dynamic="true" endRegion="HereDocument" column="0"/>
			</context>
			
			<!-- rules for heredoc types -->
			<context name="heredoc_rules" attribute="Ruby Normal Text" lineEndContext="#stay">
				<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
				<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
			</context>
			
			<!-- General delimited input support
				The contexts below handle the various gdl formats
				-->
			<context name="find_gdl_input" attribute="Ruby Normal Text" lineEndContext="#pop">
				
				<!-- handle token arrays -->
				<Detect2Chars attribute="GDL input" context="gdl_token_array_1" char="w" char1="(" />
				<Detect2Chars attribute="GDL input" context="gdl_token_array_2" char="w" char1="{" />
				<Detect2Chars attribute="GDL input" context="gdl_token_array_3" char="w" char1="[" />
				<Detect2Chars attribute="GDL input" context="gdl_token_array_4" char="w" char1="&lt;" />
				<!-- then we handle the 'any char' format -->
				<RegExpr attribute="GDL input" context="gdl_token_array_5" String="w([^\s\w])" />
				
				<!-- handle apostrophed strings -->
				<Detect2Chars attribute="GDL input" context="gdl_apostrophed_1" char="q" char1="(" />
				<Detect2Chars attribute="GDL input" context="gdl_apostrophed_2" char="q" char1="{" />
				<Detect2Chars attribute="GDL input" context="gdl_apostrophed_3" char="q" char1="[" />
				<Detect2Chars attribute="GDL input" context="gdl_apostrophed_4" char="q" char1="&lt;" />
				<!-- then we handle the 'any char' format -->
				<RegExpr attribute="GDL input" context="gdl_apostrophed_5" String="q([^\s\w])" />
				
				<!-- handle shell commands -->
				<Detect2Chars attribute="GDL input" context="gdl_shell_command_1" char="x" char1="(" />
				<Detect2Chars attribute="GDL input" context="gdl_shell_command_2" char="x" char1="{" />
				<Detect2Chars attribute="GDL input" context="gdl_shell_command_3" char="x" char1="[" />
				<Detect2Chars attribute="GDL input" context="gdl_shell_command_4" char="x" char1="&lt;" />
				<!-- then we handle the 'any char' format -->
				<RegExpr attribute="GDL input" context="gdl_shell_command_5" String="x([^\s\w])" />
				
				<!-- handle regular expressions -->
				<Detect2Chars attribute="GDL input" context="gdl_regexpr_1" char="r" char1="(" />
				<Detect2Chars attribute="GDL input" context="gdl_regexpr_2" char="r" char1="{" />
				<Detect2Chars attribute="GDL input" context="gdl_regexpr_3" char="r" char1="[" />
				<Detect2Chars attribute="GDL input" context="gdl_regexpr_4" char="r" char1="&lt;" />
				<!-- then we handle the 'any char' format -->
				<RegExpr attribute="GDL input" context="gdl_regexpr_5" String="r([^\s\w])" />
				
				<!-- handle double-quoted strings -->
				<!-- 
					be careful to make this the last GDL ruleset, because the rule for
					the short form %?foo? will otherwise catch any of the other formats
					-->
				<Detect2Chars attribute="GDL input" context="gdl_dq_string_1" char="Q" char1="(" />
				<Detect2Chars attribute="GDL input" context="gdl_dq_string_2" char="Q" char1="{" />
				<Detect2Chars attribute="GDL input" context="gdl_dq_string_3" char="Q" char1="[" />
				<Detect2Chars attribute="GDL input" context="gdl_dq_string_4" char="Q" char1="&lt;" />
				<DetectChar attribute="GDL input" context="gdl_dq_string_1" char="(" />
				<DetectChar attribute="GDL input" context="gdl_dq_string_2" char="{" />
				<DetectChar attribute="GDL input" context="gdl_dq_string_3" char="[" />
				<DetectChar attribute="GDL input" context="gdl_dq_string_4" char="&lt;" />
				<!-- then we handle the 'any char' format -->
				<RegExpr attribute="GDL input" context="gdl_dq_string_5" String="Q?([^\s\w])" />
				
			</context>
			<!-- double-quoted string specific contexts follow -->
			<context name="gdl_dq_string_1" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="dq_string_rules" />
				<Detect2Chars attribute="String" char="\" char1=")" context="#stay"/>
				<DetectChar attribute="String" context="gdl_dq_string_1_nested" char="(" />
				<DetectChar attribute="GDL input" context="#pop#pop" char=")" endRegion="GdlInput" />
			</context>
			<context name="gdl_dq_string_1_nested" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="dq_string_rules" />
				<DetectChar attribute="String" context="gdl_dq_string_1_nested" char="(" />
				<DetectChar attribute="String" context="#pop" char=")" />
			</context>
			<!-- note that here substitution should win over nesting -->
			<context name="gdl_dq_string_2" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="dq_string_rules" />
				<Detect2Chars attribute="String" char="\" char1="}" context="#stay"/>
				<DetectChar attribute="GDL input" context="#pop#pop" char="}" endRegion="GdlInput" />
				<DetectChar attribute="String" context="gdl_dq_string_2_nested" char="{" />
			</context>
			<context name="gdl_dq_string_2_nested" attribute="String" lineEndContext="#stay" >
				<DetectChar attribute="String" context="gdl_dq_string_2_nested" char="{" />
				<DetectChar attribute="String" context="#pop" char="}" />
				<IncludeRules context="dq_string_rules" />
			</context>
			
			<context name="gdl_dq_string_3" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="dq_string_rules" />
				<Detect2Chars attribute="String" char="\" char1="]" context="#stay"/>
				<DetectChar attribute="String" context="gdl_dq_string_3_nested" char="[" />
				<DetectChar attribute="GDL input" context="#pop#pop" char="]" endRegion="GdlInput" />
			</context>
			<context name="gdl_dq_string_3_nested" attribute="String" lineEndContext="#stay" >
				<DetectChar attribute="String" context="gdl_dq_string_3_nested" char="[" />
				<DetectChar attribute="String" context="#pop" char="]" />
				<IncludeRules context="dq_string_rules" />
			</context>
			
			<context name="gdl_dq_string_4" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="dq_string_rules" />
				<Detect2Chars attribute="String" char="\" char1="&gt;" context="#stay"/>
				<DetectChar attribute="String" context="gdl_dq_string_4_nested" char="&lt;" />
				<DetectChar attribute="GDL input" context="#pop#pop" char="&gt;" endRegion="GdlInput" />
			</context>
			<context name="gdl_dq_string_4_nested" attribute="String" lineEndContext="#stay" >
				<DetectChar attribute="String" context="gdl_dq_string_4_nested" char="&lt;" />
				<DetectChar attribute="String" context="#pop" char="&gt;" />
				<IncludeRules context="dq_string_rules" />
			</context>
			
			<!-- this format doesn't allow nesting. it is terminated by the next occurrence of the
				delimiter character
				-->
			<context name="gdl_dq_string_5" attribute="String" lineEndContext="#stay" dynamic="true">
				<IncludeRules context="dq_string_rules" />
				<StringDetect attribute="String" String="\%1" context="#stay" dynamic="true" />
				<RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" />
			</context>
			<!-- rules to be included in all dq_string contexts -->
			<context name="dq_string_rules" attribute="String" lineEndContext="#stay" >
				<Detect2Chars attribute="String" char="\" char1="\" context="#stay"/>
				<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
				<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
			</context>
			
			<!-- token array specific contexts -->
			
			<context name="gdl_token_array_1" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="token_array_rules" />
				<Detect2Chars attribute="String" char="\" char1=")" context="#stay"/>
				<DetectChar attribute="String" context="gdl_token_array_1_nested" char="(" />
				<DetectChar attribute="GDL input" context="#pop#pop" char=")" endRegion="GdlInput" />
			</context>
			<context name="gdl_token_array_1_nested" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="token_array_rules" />
				<DetectChar attribute="String" context="gdl_token_array_1_nested" char="(" />
				<DetectChar attribute="String" context="#pop" char=")" />
			</context>
			
			<context name="gdl_token_array_2" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="token_array_rules" />
				<Detect2Chars attribute="String" char="\" char1="}" context="#stay"/>
				<DetectChar attribute="GDL input" context="#pop#pop" char="}" endRegion="GdlInput" />
				<DetectChar attribute="String" context="gdl_token_array_2_nested" char="{" />
			</context>
			<context name="gdl_token_array_2_nested" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="token_array_rules" />
				<DetectChar attribute="String" context="gdl_token_array_2_nested" char="{" />
				<DetectChar attribute="String" context="#pop" char="}" />
			</context>
			
			<context name="gdl_token_array_3" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="token_array_rules" />
				<Detect2Chars attribute="String" char="\" char1="]" context="#stay"/>
				<DetectChar attribute="String" context="gdl_token_array_3_nested" char="[" />
				<DetectChar attribute="GDL input" context="#pop#pop" char="]" endRegion="GdlInput" />
			</context>
			<context name="gdl_token_array_3_nested" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="token_array_rules" />
				<DetectChar attribute="String" context="gdl_token_array_3_nested" char="[" />
				<DetectChar attribute="String" context="#pop" char="]" />
			</context>
			
			<context name="gdl_token_array_4" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="token_array_rules" />
				<Detect2Chars attribute="String" char="\" char1="&gt;" context="#stay"/>
				<DetectChar attribute="String" context="gdl_token_array_4_nested" char="&lt;" />
				<DetectChar attribute="GDL input" context="#pop#pop" char="&gt;" endRegion="GdlInput" />
			</context>
			<context name="gdl_token_array_4_nested" attribute="String" lineEndContext="#stay" >
				<IncludeRules context="token_array_rules" />
				<DetectChar attribute="String" context="gdl_token_array_4_nested" char="&lt;" />
				<DetectChar attribute="String" context="#pop" char="&gt;" />
			</context>
			
			<!-- this format doesn't allow nesting. it is terminated by the next occurrence of the
				delimiter character
				-->
			<context name="gdl_token_array_5" attribute="String" lineEndContext="#stay" dynamic="true">
				<IncludeRules context="token_array_rules" />
				<StringDetect attribute="String" String="\%1" context="#stay" dynamic="true"/>
				<RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" />
			</context>
			
			<!-- rules to be included in all token_array contexts -->
			<context name="token_array_rules" attribute="String" lineEndContext="#stay" >
				<Detect2Chars attribute="String" char="\" char1="\" context="#stay"/>
			</context>
			
			<!-- apostrophed string specific contexts -->
			
			<context name="gdl_apostrophed_1" attribute="Raw String" lineEndContext="#stay" >
				<IncludeRules context="apostrophed_rules" />
				<Detect2Chars attribute="Raw String" char="\" char1=")" context="#stay"/>
				<DetectChar attribute="Raw String" context="gdl_apostrophed_1_nested" char="(" />
				<DetectChar attribute="GDL input" context="#pop#pop" char=")" endRegion="GdlInput" />
			</context>
			<context name="gdl_apostrophed_1_nested" attribute="Raw String" lineEndContext="#stay" >
				<IncludeRules context="apostrophed_rules" />
				<DetectChar attribute="Raw String" context="gdl_apostrophed_1_nested" char="(" />
				<DetectChar attribute="Raw String" context="#pop" char=")" />
			</context>
			
			<context name="gdl_apostrophed_2" attribute="Raw String" lineEndContext="#stay" >
				<IncludeRules context="apostrophed_rules" />
				<Detect2Chars attribute="Raw String" char="\" char1="}" context="#stay"/>
				<DetectChar attribute="GDL input" context="#pop#pop" char="}" endRegion="GdlInput" />
				<DetectChar attribute="Raw String" context="gdl_apostrophed_2_nested" char="{" />
			</context>
			<context name="gdl_apostrophed_2_nested" attribute="Raw String" lineEndContext="#stay" >
				<IncludeRules context="apostrophed_rules" />
				<DetectChar attribute="Raw String" context="gdl_apostrophed_2_nested" char="{" />
				<DetectChar attribute="Raw String" context="#pop" char="}" />
			</context>
			
			<context name="gdl_apostrophed_3" attribute="Raw String" lineEndContext="#stay" >
				<IncludeRules context="apostrophed_rules" />
				<Detect2Chars attribute="Raw String" char="\" char1="]" context="#stay"/>
				<DetectChar attribute="Raw String" context="gdl_apostrophed_3_nested" char="[" />
				<DetectChar attribute="GDL input" context="#pop#pop" char="]" endRegion="GdlInput" />
			</context>
			<context name="gdl_apostrophed_3_nested" attribute="Raw String" lineEndContext="#stay" >
				<IncludeRules context="apostrophed_rules" />
				<DetectChar attribute="Raw String" context="gdl_apostrophed_3_nested" char="[" />
				<DetectChar attribute="Raw String" context="#pop" char="]" />
			</context>
			
			<context name="gdl_apostrophed_4" attribute="Raw String" lineEndContext="#stay" >
				<IncludeRules context="apostrophed_rules" />
				<Detect2Chars attribute="Raw String" char="\" char1="&gt;" context="#stay"/>
				<DetectChar attribute="Raw String" context="gdl_apostrophed_4_nested" char="&lt;" />
				<DetectChar attribute="GDL input" context="#pop#pop" char="&gt;" endRegion="GdlInput" />
			</context>
			<context name="gdl_apostrophed_4_nested" attribute="Raw String" lineEndContext="#stay" >
				<IncludeRules context="apostrophed_rules" />
				<DetectChar attribute="Raw String" context="gdl_apostrophed_4_nested" char="&lt;" />
				<DetectChar attribute="Raw String" context="#pop" char="&gt;" />
			</context>
			
			<!-- this format doesn't allow nesting. it is terminated by the next occurrence of the
				delimiter character
				-->
			<context name="gdl_apostrophed_5" attribute="Raw String" lineEndContext="#stay" dynamic="true">
				<IncludeRules context="apostrophed_rules" />
				<StringDetect attribute="Raw String" String="\%1" context="#stay" dynamic="true"/>
				<RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" />
			</context>
			
			<!-- rules to be included in all apostrophed contexts -->
			<context name="apostrophed_rules" attribute="Raw String" lineEndContext="#stay" >
				<Detect2Chars attribute="Raw String" char="\" char1="\" context="#stay"/>
			</context>
			
			<!-- shell command specific contexts -->
			
			<context name="gdl_shell_command_1" attribute="Command" lineEndContext="#stay" >
				<IncludeRules context="shell_command_rules" />
				<Detect2Chars attribute="Command" char="\" char1=")" context="#stay"/>
				<DetectChar attribute="Command" context="gdl_shell_command_1_nested" char="(" />
				<DetectChar attribute="GDL input" context="#pop#pop" char=")" endRegion="GdlInput" />
			</context>
			<context name="gdl_shell_command_1_nested" attribute="Command" lineEndContext="#stay" >
				<IncludeRules context="shell_command_rules" />
				<DetectChar attribute="Command" context="gdl_shell_command_1_nested" char="(" />
				<DetectChar attribute="Command" context="#pop" char=")" />
			</context>
			
			<context name="gdl_shell_command_2" attribute="Command" lineEndContext="#stay" >
				<IncludeRules context="shell_command_rules" />
				<Detect2Chars attribute="Command" char="\" char1="}" context="#stay"/>
				<DetectChar attribute="GDL input" context="#pop#pop" char="}" endRegion="GdlInput" />
				<DetectChar attribute="Command" context="gdl_shell_command_2_nested" char="{" />
			</context>
			<context name="gdl_shell_command_2_nested" attribute="Command" lineEndContext="#stay" >
				<IncludeRules context="shell_command_rules" />
				<DetectChar attribute="Command" context="gdl_shell_command_2_nested" char="{" />
				<DetectChar attribute="Command" context="#pop" char="}" />
			</context>
			
			<context name="gdl_shell_command_3" attribute="Command" lineEndContext="#stay" >
				<IncludeRules context="shell_command_rules" />
				<Detect2Chars attribute="Command" char="\" char1="]" context="#stay"/>
				<DetectChar attribute="Command" context="gdl_shell_command_3_nested" char="[" />
				<DetectChar attribute="GDL input" context="#pop#pop" char="]" endRegion="GdlInput" />
			</context>
			<context name="gdl_shell_command_3_nested" attribute="Command" lineEndContext="#stay" >
				<IncludeRules context="shell_command_rules" />
				<DetectChar attribute="Command" context="gdl_shell_command_3_nested" char="[" />
				<DetectChar attribute="Command" context="#pop" char="]" />
			</context>
			
			<context name="gdl_shell_command_4" attribute="Command" lineEndContext="#stay" >
				<IncludeRules context="shell_command_rules" />
				<Detect2Chars attribute="Command" char="\" char1="&gt;" context="#stay"/>
				<DetectChar attribute="Command" context="gdl_shell_command_4_nested" char="&lt;" />
				<DetectChar attribute="GDL input" context="#pop#pop" char="&gt;" endRegion="GdlInput" />
			</context>
			<context name="gdl_shell_command_4_nested" attribute="Command" lineEndContext="#stay" >
				<IncludeRules context="shell_command_rules" />
				<DetectChar attribute="Command" context="gdl_shell_command_4_nested" char="&lt;" />
				<DetectChar attribute="Command" context="#pop" char="&gt;" />
			</context>
			
			<!-- this format doesn't allow nesting. it is terminated by the next occurrence of the
				delimiter character
				-->
			<context name="gdl_shell_command_5" attribute="Command" lineEndContext="#stay" dynamic="true">
				<IncludeRules context="shell_command_rules" />
				<StringDetect attribute="Command" String="\%1" context="#stay" dynamic="true" />
				<RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1" dynamic="true" endRegion="GdlInput" />
			</context>
			
			<!-- rules to be included in all shell_command contexts -->
			<context name="shell_command_rules" attribute="Command" lineEndContext="#stay" >
				<Detect2Chars attribute="Command" char="\" char1="\" context="#stay"/>
				<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
				<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
			</context>
			
			<!-- regular expression specific contexts -->
			
			<context name="gdl_regexpr_1" attribute="Regular Expression" lineEndContext="#stay" >
				<IncludeRules context="regexpr_rules" />
				<Detect2Chars attribute="Regular Expression" char="\" char1=")" context="#stay"/>
				<DetectChar attribute="Regular Expression" context="gdl_regexpr_1_nested" char="(" />
				<RegExpr attribute="GDL input" context="#pop#pop" String="\)[uiomxn]*" endRegion="GdlInput" />
			</context>
			<context name="gdl_regexpr_1_nested" attribute="Regular Expression" lineEndContext="#stay" >
				<IncludeRules context="regexpr_rules" />
				<DetectChar attribute="Regular Expression" context="gdl_regexpr_1_nested" char="(" />
				<DetectChar attribute="Regular Expression" context="#pop" char=")" />
			</context>
			
			<context name="gdl_regexpr_2" attribute="Regular Expression" lineEndContext="#stay" >
				<IncludeRules context="regexpr_rules" />
				<Detect2Chars attribute="Regular Expression" char="\" char1="}" context="#stay"/>
				<RegExpr attribute="GDL input" context="#pop#pop" String="\}[uiomxn]*" endRegion="GdlInput" />
				<DetectChar attribute="Regular Expression" context="gdl_regexpr_2_nested" char="{" />
			</context>
			<context name="gdl_regexpr_2_nested" attribute="Regular Expression" lineEndContext="#stay" >
				<IncludeRules context="regexpr_rules" />
				<DetectChar attribute="Regular Expression" context="gdl_regexpr_2_nested" char="{" />
				<DetectChar attribute="Regular Expression" context="#pop" char="}" />
			</context>
			
			<context name="gdl_regexpr_3" attribute="Regular Expression" lineEndContext="#stay" >
				<IncludeRules context="regexpr_rules" />
				<Detect2Chars attribute="Regular Expression" char="\" char1="]" context="#stay"/>
				<DetectChar attribute="Regular Expression" context="gdl_regexpr_3_nested" char="[" />
				<RegExpr attribute="GDL input" context="#pop#pop" String="\][uiomxn]*" endRegion="GdlInput" />
			</context>
			<context name="gdl_regexpr_3_nested" attribute="Regular Expression" lineEndContext="#stay" >
				<IncludeRules context="regexpr_rules" />
				<DetectChar attribute="Regular Expression" context="gdl_regexpr_3_nested" char="[" />
				<DetectChar attribute="Regular Expression" context="#pop" char="]" />
			</context>
			
			<context name="gdl_regexpr_4" attribute="Regular Expression" lineEndContext="#stay" >
				<IncludeRules context="regexpr_rules" />
				<Detect2Chars attribute="Regular Expression" char="\" char1="&gt;" context="#stay"/>
				<DetectChar attribute="Regular Expression" context="gdl_regexpr_4_nested" char="&lt;" />
				<RegExpr attribute="GDL input" context="#pop#pop" String="&gt;[uiomxn]*" endRegion="GdlInput" />
			</context>
			<context name="gdl_regexpr_4_nested" attribute="Regular Expression" lineEndContext="#stay" >
				<IncludeRules context="regexpr_rules" />
				<DetectChar attribute="Regular Expression" context="gdl_regexpr_4_nested" char="&lt;" />
				<DetectChar attribute="Regular Expression" context="#pop" char="&gt;" />
			</context>
			
			<!-- this format doesn't allow nesting. it is terminated by the next occurrence of the
				delimiter character
				-->
			<context name="gdl_regexpr_5" attribute="Regular Expression" lineEndContext="#stay" dynamic="true">
				<IncludeRules context="regexpr_rules" />
				<StringDetect attribute="Regular Expression" String="\%1" context="#stay" dynamic="true" />
				<RegExpr attribute="GDL input" context="#pop#pop" String="\s*%1[uiomxn]*" dynamic="true" endRegion="GdlInput" />
			</context>
			
			<!-- rules to be included in all regexpr contexts -->
			<context name="regexpr_rules" attribute="Regular Expression" lineEndContext="#stay" >
				<Detect2Chars attribute="Regular Expression" char="\" char1="\" context="#stay"/>
				<RegExpr attribute="Substitution" String="#@{1,2}" context="Short Subst"/>
				<Detect2Chars attribute="Substitution" char="#" char1="{" context="Subst"/>
			</context>
			
			<!-- END of General delimited input support -->
			
			<!-- handle data in script -->
			<context name="DATA" attribute="Data" lineEndContext="#stay"/>
		<!-- END Ruby contexts -->			
		</contexts>
		
		<itemDatas>
		<!-- BEGIN Ruby itemData -->
			<itemData name="Ruby Normal Text" defStyleNum="dsNormal"/>
			<itemData name="RUBY RAILS ERB Text" defStyleNum="dsExtension" bold="0" spellChecking="false"/>
			<itemData name="Ruby Source" defStyleNum="dsDataType" bold="1" spellChecking="false"/>
			
			<itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false"/>
			<itemData name="Attribute Definition" defStyleNum="dsOthers" spellChecking="false"/>
			<itemData name="Access Control" defStyleNum="dsAttribute" bold="1" spellChecking="false"/> <!-- #0000FF -->
			<itemData name="Definition" defStyleNum="dsKeyword" spellChecking="false"/>
			<itemData name="Pseudo variable" defStyleNum="dsDecVal" spellChecking="false"/>
			
			<itemData name="Dec" defStyleNum="dsDecVal" spellChecking="false"/>
			<itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/>
			<itemData name="Char" defStyleNum="dsChar" spellChecking="false"/>
			<itemData name="Octal" defStyleNum="dsBaseN" spellChecking="false"/>
			<itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/>
			<itemData name="Bin" defStyleNum="dsBaseN" spellChecking="false"/>
			
			<itemData name="Symbol" defStyleNum="dsWarning" bold="0" underline="0" spellChecking="false"/> <!-- #D40000 -->
			<itemData name="String" defStyleNum="dsString"/>
			<itemData name="Raw String" defStyleNum="dsVerbatimString"/> <!-- #DD4A4A -->
			<itemData name="Command" defStyleNum="dsInformation"/> <!-- #AA3000 -->
			<itemData name="Message" defStyleNum="dsAttribute" spellChecking="false"/> <!-- #4000A7 -->
			<itemData name="Regular Expression" defStyleNum="dsSpecialString" spellChecking="false"/> <!-- #4A5704 -->
			<itemData name="Substitution"	defStyleNum="dsSpecialChar" spellChecking="false"/>
			<itemData name="Data" defStyleNum="dsNormal"/>
			<!-- short for 'general delimited input' -->
			<itemData name="GDL input" defStyleNum="dsOthers" />
			
			<itemData name="Default globals" defStyleNum="dsVariable" bold="1" spellChecking="false"/> <!-- #C00000 -->
			<itemData name="Global Variable" defStyleNum="dsVariable" spellChecking="false"/> <!-- #C00000 -->
			<itemData name="Global Constant" defStyleNum="dsConstant" bold="1" spellChecking="false"/> <!-- #bb1188 -->
			<itemData name="Constant" defStyleNum="dsDataType" spellChecking="false"/>
			<itemData name="Constant Value" defStyleNum="dsConstant" bold="0" spellChecking="false"/> <!-- #bb1188 -->
			<itemData name="Kernel methods" defStyleNum="dsFunction" bold="1" spellChecking="false"/> <!-- #000080, #CC0E86 -->
			<itemData name="Member" defStyleNum="dsNormal" spellChecking="false"/>
			<itemData name="Instance Variable" defStyleNum="dsOthers" spellChecking="false"/>
			<itemData name="Class Variable" defStyleNum="dsOthers" spellChecking="false"/>
			
			<itemData name="Ruby Comment" defStyleNum="dsComment"/>
			<itemData name="Blockcomment" defStyleNum="dsComment"/>
			<itemData name="RDoc Value" defStyleNum="dsOthers"/>
			
			<!-- use these to mark errors and alerts things -->
			<itemData name="Error" defStyleNum="dsError" spellChecking="false"/>

			<itemData name="Delimiter" defStyleNum="dsChar" spellChecking="false"/>
			<itemData name="Operator" defStyleNum="dsChar" spellChecking="false"/>
		<!-- END Ruby itemData -->
			
		<!-- BEGIN HTML itemData -->
			<itemData name="Normal Text" defStyleNum="dsNormal" />
			<itemData name="Comment" defStyleNum="dsComment" />
			<itemData name="CDATA" defStyleNum="dsBaseN" bold="1" spellChecking="false"/>
			<itemData name="Processing Instruction" defStyleNum="dsKeyword" spellChecking="false"/>
			<itemData name="Doctype" defStyleNum="dsDataType" bold="1" spellChecking="false"/>
			<itemData name="Element" defStyleNum="dsKeyword" spellChecking="false"/>
			<itemData name="Attribute" defStyleNum="dsOthers" spellChecking="false"/>
			<itemData name="Value" defStyleNum="dsString" spellChecking="false"/>
			<itemData name="EntityRef" defStyleNum="dsDecVal" spellChecking="false"/>
			<itemData name="PEntityRef" defStyleNum="dsDecVal" spellChecking="false"/>
		<!-- END HTML itemData -->
		
		</itemDatas>
	</highlighting>
	<general>
		<comments>
			<comment name="multiLine" start="&lt;!--" end="--&gt;" region="comment" />
		</comments>
		<keywords casesensitive="1" weakDeliminator="!?"/> 
	</general>
</language>
<!-- kate: replace-tabs off; -->
