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

 This file is part of GtkSourceView

 Author: Paolo Borelli <pborelli@gnome.org>
 Copyright (C) 2007 Paolo Borelli

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

 GtkSourceView 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
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

-->
<language id="erlang" _name="Erlang" version="2.0" _section="Sources">
  <metadata>
    <property name="mimetypes">text/x-erlang</property>
    <property name="globs">*.erl</property>
    <property name="line-comment-start">%</property>
  </metadata>

  <styles>
    <style id="comment" _name="Comment" map-to="def:comment"/>
    <style id="keyword" _name="Keyword" map-to="def:keyword"/>
    <style id="operator" _name="Operator" map-to="def:operator"/>
    <style id="atom" _name="Atom" map-to="def:type"/>
    <style id="string" _name="String" map-to="def:string"/>
    <style id="floating-point" _name="Floating point number" map-to="def:floating-point"/>
    <style id="decimal" _name="Decimal number" map-to="def:decimal"/>
    <style id="base-n-integer" _name="Base-N Integer" map-to="def:base-n-integer"/>
    <style id="builtin" _name="Builtin" map-to="def:builtin"/>
    <style id="compiler-directive" _name="Compiler Directive" map-to="def:preprocessor"/>
  </styles>

  <definitions>

    <context id="line-comment" style-ref="comment" end-at-line-end="true" class="comment" class-disabled="no-spell-check">
      <start>%</start>
      <include>
        <context ref="def:in-line-comment"/>
      </include>
    </context>

    <context id="keywords" style-ref="keyword">
      <keyword>after</keyword>
      <keyword>begin</keyword>
      <keyword>case</keyword>
      <keyword>catch</keyword>
      <keyword>cond</keyword>
      <keyword>end</keyword>
      <keyword>fun</keyword>
      <keyword>if</keyword>
      <keyword>let</keyword>
      <keyword>of</keyword>
      <keyword>query</keyword>
      <keyword>receive</keyword>
      <keyword>when</keyword>
    </context>

    <context id="operators" style-ref="operator">
      <keyword>and</keyword>
      <keyword>band</keyword>
      <keyword>bnot</keyword>
      <keyword>bor</keyword>
      <keyword>bsl</keyword>
      <keyword>bsr</keyword>
      <keyword>bxor</keyword>
      <keyword>div</keyword>
      <keyword>not</keyword>
      <keyword>or</keyword>
      <keyword>rem</keyword>
      <keyword>xor</keyword>
    </context>

    <context id="atom" style-ref="atom">
      <start>'</start>
      <end>'</end>
      <include>
        <context ref="def:escape"/>
      </include>
    </context>

    <context id="string" style-ref="string" class="string" class-disabled="no-spell-check">
      <start>"</start>
      <end>"</end>
      <include>
        <context ref="def:escape"/>
      </include>
    </context>

    <context id="float" style-ref="floating-point">
      <match extended="true">
        (?&lt;![\w\.])
        [0-9]+\.[0-9]+([Ee][+-]?[0-9]+)?
        (?![\w\.])
      </match>
    </context>

    <context id="base-n-number" style-ref="base-n-integer">
      <match extended="true">
        (?&lt;![\w\.])
        [1-9]([0-9])?#[0-9a-fA-F]+
        (?![\w\.])
      </match>
    </context>

    <context id="decimal-number" style-ref="decimal">
      <match extended="true">
        (?&lt;![\w\.])
        [0-9]+
        (?![\w\.])
      </match>
    </context>

    <context id="builtins" style-ref="builtin">
      <keyword>abs</keyword>
      <keyword>alive</keyword>
      <keyword>apply</keyword>
      <keyword>atom_to_list</keyword>
      <keyword>atom</keyword>
      <keyword>binary_to_list</keyword>
      <keyword>binary_to_ter</keyword>
      <keyword>binary</keyword>
      <keyword>check_process_code</keyword>
      <keyword>concat_binary</keyword>
      <keyword>constant</keyword>
      <keyword>date</keyword>
      <keyword>delete_module</keyword>
      <keyword>disconnect_node</keyword>
      <keyword>element</keyword>
      <keyword>erase</keyword>
      <keyword>exit</keyword>
      <keyword>float</keyword>
      <keyword>float_to_list</keyword>
      <keyword>function</keyword>
      <keyword>get_cookie</keyword>
      <keyword>get_keys</keyword>
      <keyword>get</keyword>
      <keyword>group_leader</keyword>
      <keyword>halt</keyword>
      <keyword>hash</keyword>
      <keyword>hd</keyword>
      <keyword>integer_to_list</keyword>
      <keyword>integer</keyword>
      <keyword>is_alive</keyword>
      <keyword>length</keyword>
      <keyword>link</keyword>
      <keyword>list_to_atom</keyword>
      <keyword>list_to_binary</keyword>
      <keyword>list_to_float</keyword>
      <keyword>list_to_integer</keyword>
      <keyword>list_to_pid</keyword>
      <keyword>list_to_tuple</keyword>
      <keyword>list</keyword>
      <keyword>load_module</keyword>
      <keyword>make_ref</keyword>
      <keyword>math</keyword>
      <keyword>module_loaded</keyword>
      <keyword>monitor_node</keyword>
      <keyword>node</keyword>
      <keyword>nodes</keyword>
      <keyword>now</keyword>
      <keyword>number</keyword>
      <keyword>open_port</keyword>
      <keyword>pid_to_list</keyword>
      <keyword>pid</keyword>
      <keyword>ports</keyword>
      <keyword>port_close</keyword>
      <keyword>port_info</keyword>
      <keyword>preloaded</keyword>
      <keyword>processes</keyword>
      <keyword>process_flag</keyword>
      <keyword>process_info</keyword>
      <keyword>process</keyword>
      <keyword>purge_module</keyword>
      <keyword>put</keyword>
      <keyword>record</keyword>
      <keyword>reference</keyword>
      <keyword>registered</keyword>
      <keyword>register</keyword>
      <keyword>round</keyword>
      <keyword>self</keyword>
      <keyword>setelement</keyword>
      <keyword>set_cookie</keyword>
      <keyword>set_node</keyword>
      <keyword>size</keyword>
      <keyword>spawn_link</keyword>
      <keyword>spawn</keyword>
      <keyword>split_binary</keyword>
      <keyword>statistics</keyword>
      <keyword>term_to_binary</keyword>
      <keyword>throw</keyword>
      <keyword>time</keyword>
      <keyword>tl</keyword>
      <keyword>trunc</keyword>
      <keyword>tuple_to_list</keyword>
      <keyword>unlink</keyword>
      <keyword>unregister</keyword>
      <keyword>whereis</keyword>
    </context>

    <context id="compiler-directives" style-ref="compiler-directive">
      <prefix>-</prefix>
      <keyword>author</keyword>
      <keyword>compile</keyword>
      <keyword>copyright</keyword>
      <keyword>define</keyword>
      <keyword>doc</keyword>
      <keyword>else</keyword>
      <keyword>endif</keyword>
      <keyword>export</keyword>
      <keyword>file</keyword>
      <keyword>ifdef</keyword>
      <keyword>ifndef</keyword>
      <keyword>import</keyword>
      <keyword>include_lib</keyword>
      <keyword>include</keyword>
      <keyword>module</keyword>
      <keyword>record</keyword>
      <keyword>undef</keyword>
    </context>

    <context id="erlang" class="no-spell-check">
      <include>
        <context ref="line-comment"/>
        <context ref="keywords"/>
        <context ref="operators"/>
        <context ref="atom"/>
        <context ref="string"/>
        <context ref="float"/>
        <context ref="base-n-number"/>
        <context ref="decimal-number"/>
        <context ref="builtins"/>
        <context ref="compiler-directives"/>
      </include>
    </context>

  </definitions>

</language>
