<?xml version="1.0" encoding="UTF-8"?>
<!--

 Author: Mario Steele <mario@ruby-im.net>

 This library is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program 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 General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

-->
<language id="euphoria" _name="Euphoria" version="2.0" _section="Scripts">
		<metadata>
				<property name="mimetypes">application/euphoria;text/euphoria</property>
				<property name="globs">*.e;*.ew;*.eu;*.ex;*.exw;*.exu</property>
				<property name="line-comment-start">--</property>
		</metadata>

		<styles>
				<style id="keyword"              _name="Keyword"               map-to="def:keyword" />
				<style id="builtin"              _name="Builtin"               map-to="def:type" />
				<style id="decimal"              _name="Decimal number"        map-to="def:decimal"/>
				<style id="base-n-integer"       _name="Base-N number"         map-to="def:note"/>
		    	<style id="comment"              _name="Comment"               map-to="def:comment"/>
				<style id="string"               _name="String"                map-to="def:string"/>
        		<style id="char"                 _name="Character"             map-to="def:character"/>
        		<style id="boolean"              _name="Boolean value"         map-to="def:boolean"/>
		</styles>

		<definitions>

        <define-regex id="escaped-character" extended="true">
            \\(                   # leading backslash
            [\\\"\'nrbtfav\?] |   # escaped character
            [0-7]{1,3} |          # one, two, or three octal digits
            x[0-9A-Fa-f]+         # 'x' followed by hex digits
            )
        </define-regex>

				<context id="keyword" style-ref="keyword">
						<keyword>and</keyword>
						<keyword>as</keyword>
						<keyword>break</keyword>
						<keyword>by</keyword>
						<keyword>case</keyword>
						<keyword>constant</keyword>
						<keyword>continue</keyword>
						<keyword>do</keyword>
						<keyword>else</keyword>
						<keyword>elsedef</keyword>
						<keyword>elsif</keyword>
						<keyword>elsifdef</keyword>
						<keyword>end</keyword>
						<keyword>entry</keyword>
						<keyword>enum</keyword>
						<keyword>exit</keyword>
						<keyword>export</keyword>
						<keyword>for</keyword>
						<keyword>function</keyword>
						<keyword>global</keyword>
						<keyword>goto</keyword>
						<keyword>if</keyword>
						<keyword>ifdef</keyword>
						<keyword>include</keyword>
						<keyword>label</keyword>
						<keyword>loop</keyword>
						<keyword>namespace</keyword>
						<keyword>not</keyword>
						<keyword>or</keyword>
						<keyword>override</keyword>
						<keyword>procedure</keyword>
						<keyword>public</keyword>
						<keyword>retry</keyword>
						<keyword>return</keyword>
						<keyword>switch</keyword>
						<keyword>then</keyword>
						<keyword>to</keyword>
						<keyword>type</keyword>
						<keyword>until</keyword>
						<keyword>while</keyword>
						<keyword>with</keyword>
						<keyword>without</keyword>
						<keyword>xor</keyword>
				</context>

				<context id="builtin" style-ref="builtin">
						<keyword>abort</keyword>
						<keyword>and_bits</keyword>
						<keyword>append</keyword>
						<keyword>arctan</keyword>
						<keyword>atom</keyword>
						<keyword>c_func</keyword>
						<keyword>c_proc</keyword>
						<keyword>call</keyword>
						<keyword>call_func</keyword>
						<keyword>call_proc</keyword>
						<keyword>clear_screen</keyword>
						<keyword>close</keyword>
						<keyword>command_line</keyword>
						<keyword>compare</keyword>
						<keyword>connect</keyword>
						<keyword>cos</keyword>
						<keyword>date</keyword>
						<keyword>display</keyword>
						<keyword>equal</keyword>
						<keyword>find</keyword>
						<keyword>find_from</keyword>
						<keyword>floor</keyword>
						<keyword>format</keyword>
						<keyword>get_key</keyword>
						<keyword>get_pixel</keyword>
						<keyword>getc</keyword>
						<keyword>getenv</keyword>
						<keyword>gets</keyword>
						<keyword>hash</keyword>
						<keyword>head</keyword>
						<keyword>include_paths</keyword>
						<keyword>insert</keyword>
						<keyword>integer</keyword>
						<keyword>length</keyword>
						<keyword>log</keyword>
						<keyword>machine_func</keyword>
						<keyword>machine_proc</keyword>
						<keyword>match</keyword>
						<keyword>match_from</keyword>
						<keyword>mem_copy</keyword>
						<keyword>mem_set</keyword>
						<keyword>not_bits</keyword>
						<keyword>object</keyword>
						<keyword>open</keyword>
						<keyword>option_switches</keyword>
						<keyword>or_bits</keyword>
						<keyword>peek</keyword>
						<keyword>peeks</keyword>
						<keyword>peek_string</keyword>
						<keyword>peek2s</keyword>
						<keyword>peek2u</keyword>
						<keyword>peek4s</keyword>
						<keyword>peek4u</keyword>
						<keyword>pixel</keyword>
						<keyword>platform</keyword>
						<keyword>poke</keyword>
						<keyword>poke2</keyword>
						<keyword>poke4</keyword>
						<keyword>position</keyword>
						<keyword>power</keyword>
						<keyword>prepend</keyword>
						<keyword>print</keyword>
						<keyword>printf</keyword>
						<keyword>profile</keyword>
						<keyword>profile_time</keyword>
						<keyword>puts</keyword>
						<keyword>rand</keyword>
						<keyword>remainder</keyword>
						<keyword>remove</keyword>
						<keyword>repeat</keyword>
						<keyword>replace</keyword>
						<keyword>routine_id</keyword>
						<keyword>set</keyword>
						<keyword>sequence</keyword>
						<keyword>sin</keyword>
						<keyword>splice</keyword>
						<keyword>sprintf</keyword>
						<keyword>sqrt</keyword>
						<keyword>system</keyword>
						<keyword>system_exec</keyword>
						<keyword>tan</keyword>
						<keyword>tail</keyword>
						<keyword>task_clock_start</keyword>
						<keyword>task_clock_stop</keyword>
						<keyword>task_create</keyword>
						<keyword>task_list</keyword>
						<keyword>task_schedule</keyword>
						<keyword>task_self</keyword>
						<keyword>task_status</keyword>
						<keyword>task_suspend</keyword>
						<keyword>task_yield</keyword>
						<keyword>time</keyword>
						<keyword>trace</keyword>
						<keyword>warning</keyword>

					<keyword>create</keyword>
					<keyword>set</keyword>
					<keyword>get</keyword>
					<keyword>add</keyword>
					<keyword>connect</keyword>
					<keyword>pack_start</keyword>
					<keyword>pack_end</keyword>
					<keyword>show</keyword>
					<keyword>show_all</keyword>
					<keyword>main</keyword>
					<keyword>Info</keyword>	
					<keyword>Question</keyword>
					<keyword>Warn</keyword>
					<keyword>Error</keyword>
					<keyword>Custom</keyword>
			
				</context>

				<context id="decimal" style-ref="decimal">
							<match>(?&lt;![\w\.])([1-9](_?[0-9])*|0)(?![\w\.])</match>
				</context>

				<context id="hex" style-ref="base-n-integer">
							<match>(?&lt;![\w\.])#[0-9A-Fa-f](_?[0-9A-Fa-f])*(?![\w\.])</match>
				</context>

    <context id="string" style-ref="string" end-at-line-end="false" class="string">
      <start>["`]</start>
      <end>\%{0@start}</end>
    </context>


				<context id="char" style-ref="char">
							<match>L?'(\%{escaped-character}|.)'</match>
				</context>

				<context id="boolean" style-ref="boolean">
							<keyword>TRUE</keyword>
							<keyword>FALSE</keyword>
							<keyword>NULL</keyword>
				</context>

				<context id="comment" style-ref="comment" end-at-line-end="true">
							<start>--</start>
							<include>
									<context ref="def:in-line-comment" />
							</include>
				</context>

				<context id="euphoria">
						<include>
								<context ref="def:shebang"           />
								<context ref="builtin"               />
								<context ref="keyword"               />
								<context ref="decimal"               />
								<context ref="hex"                   />
								<context ref="string"                />
								<context ref="char"                  />
								<context ref="boolean"               />
								<context ref="comment"               />
						</include>
				</context>
		</definitions>
</language>
