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

 Author: John Luke <jluke@cfl.rr.com>
 Copyright (C) 2003 John Luke <jluke@cfl.rr.com>
 Copyright (C) 2004 Jeroen Zwartepoorte <jeroen@xs4all.nl>
 Copyright (C) 2004 Alessio Frusciante <algol@firenze.linux.it>
 Copyright (C) 2005 Brion Vibber <brion@pobox.com>
 Copyright (C) 2007-2008 Jürg Billeter <j@bitron.ch>

 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., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.

-->
<language id="vala" _name="Vala" version="2.0" _section="Sources">
  <metadata>
    <property name="mimetypes">text/x-vala</property>
    <property name="globs">*.vala</property>
    <property name="line-comment-start">//</property>
    <property name="block-comment-start">/*</property>
    <property name="block-comment-end">*/</property>
  </metadata>

  <styles>
    <style id="comment" _name="Comment" map-to="def:comment"/>
    <style id="error" _name="Error" map-to="def:error"/>
    <style id="type" _name="Data Type" map-to="def:type"/>
    <style id="string" _name="String" map-to="def:string"/>
    <style id="keyword" _name="Keyword" map-to="def:keyword"/>
    <style id="null-value" _name="Null Value" map-to="def:special-constant"/>
    <style id="boolean" _name="Boolean value" map-to="def:boolean"/>
    <style id="decimal" _name="Decimal number" map-to="def:decimal"/>
    <style id="hexadecimal" _name="Hexadecimal number" map-to="def:base-n-integer"/>
    <style id="real" _name="Real number" map-to="def:floating-point"/>
  </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="multiline-comment" style-ref="comment" class="comment" class-disabled="no-spell-check">
      <start>/\*</start>
      <end>\*/</end>
      <include>
        <context ref="def:in-comment"/>
      </include>
    </context>

    <context id="close-comment-outside-comment" style-ref="error">
      <match>\*/(?!\*)</match>
    </context>

    <context id="multiline-string" style-ref="string" class="string" class-disabled="no-spell-check">
      <start>@"([^"]|"")*</start>
      <end>"</end>
      <include>
        <context ref="def:escape"/>
        <context ref="def:line-continue"/>
      </include>
    </context>

    <context id="keywords" style-ref="keyword">
      <keyword>class</keyword>
      <keyword>delegate</keyword>
      <keyword>enum</keyword>
      <keyword>errordomain</keyword>
      <keyword>interface</keyword>
      <keyword>namespace</keyword>
      <keyword>signal</keyword>
      <keyword>struct</keyword>
      <keyword>using</keyword>
      <!-- modifiers -->
      <keyword>abstract</keyword>
      <keyword>const</keyword>
      <keyword>dynamic</keyword>
      <keyword>extern</keyword>
      <keyword>inline</keyword>
      <keyword>internal</keyword>
      <keyword>out</keyword>
      <keyword>override</keyword>
      <keyword>owned</keyword>
      <keyword>private</keyword>
      <keyword>protected</keyword>
      <keyword>public</keyword>
      <keyword>ref</keyword>
      <keyword>static</keyword>
      <keyword>unowned</keyword>
      <keyword>virtual</keyword>
      <keyword>volatile</keyword>
      <keyword>weak</keyword>
      <!-- others -->
      <keyword>as</keyword>
      <keyword>base</keyword>
      <keyword>break</keyword>
      <keyword>case</keyword>
      <keyword>catch</keyword>
      <keyword>construct</keyword>
      <keyword>continue</keyword>
      <keyword>default</keyword>
      <keyword>delete</keyword>
      <keyword>do</keyword>
      <keyword>else</keyword>
      <keyword>ensures</keyword>
      <keyword>finally</keyword>
      <keyword>for</keyword>
      <keyword>foreach</keyword>
      <keyword>get</keyword>
      <keyword>if</keyword>
      <keyword>in</keyword>
      <keyword>is</keyword>
      <keyword>lock</keyword>
      <keyword>new</keyword>
      <keyword>requires</keyword>
      <keyword>return</keyword>
      <keyword>set</keyword>
      <keyword>sizeof</keyword>
      <keyword>switch</keyword>
      <keyword>this</keyword>
      <keyword>throw</keyword>
      <keyword>throws</keyword>
      <keyword>try</keyword>
      <keyword>typeof</keyword>
      <keyword>value</keyword>
      <keyword>var</keyword>
      <keyword>void</keyword>
      <keyword>while</keyword>
      <keyword>yield</keyword>
      <keyword>yields</keyword>
    </context>

    <context id="primitives" style-ref="type">
      <keyword>bool</keyword>
      <keyword>char</keyword>
      <keyword>double</keyword>
      <keyword>float</keyword>
      <keyword>int</keyword>
      <keyword>int8</keyword>
      <keyword>int16</keyword>
      <keyword>int32</keyword>
      <keyword>int64</keyword>
      <keyword>long</keyword>
      <keyword>short</keyword>
      <keyword>size_t</keyword>
      <keyword>ssize_t</keyword>
      <keyword>string</keyword>
      <keyword>uchar</keyword>
      <keyword>uint</keyword>
      <keyword>uint8</keyword>
      <keyword>uint16</keyword>
      <keyword>uint32</keyword>
      <keyword>uint64</keyword>
      <keyword>ulong</keyword>
      <keyword>unichar</keyword>
      <keyword>ushort</keyword>
    </context>

    <context id="null-value" style-ref="null-value">
      <keyword>null</keyword>
    </context>

    <context id="boolean" style-ref="boolean">
      <keyword>false</keyword>
      <keyword>true</keyword>
    </context>

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

    <context id="hexadecimal" style-ref="hexadecimal">
      <match extended="true">
        (?&lt;![\w\.])
        0[xX][a-fA-F0-9]+[uUlL]*
        (?![\w\.])
      </match>
    </context>

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

    <context id="vala" class="no-spell-check">
      <include>
        <context ref="def:string"/>
        <context ref="def:single-quoted-string"/>
        <context ref="line-comment"/>
        <context ref="multiline-comment"/>
        <context ref="close-comment-outside-comment"/>
        <context ref="multiline-string"/>
        <context ref="keywords"/>
        <context ref="primitives"/>
        <context ref="null-value"/>
        <context ref="boolean"/>
        <context ref="decimal"/>
        <context ref="hexadecimal"/>
        <context ref="real"/>
      </include>
    </context>
  </definitions>
</language>
