Blob Blame History Raw
<?xml version="1.0" encoding="UTF-8"?>
<!--

 This file is part of GtkSourceView

 Authors: Min Huang, Felix Dietze
   Copyright (C) 2009 Min Huang <min.huang@alumni.usc.edu>
   Copyright (C) 2012 Felix Dietze <felix@beerleader.net>

 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, see <http://www.gnu.org/licenses/>.

-->
<language id="scala" name="Scala" version="2.0" _section="Source">

  <metadata>
    <property name="mimetypes">text/x-scala</property>
    <property name="globs">*.scala</property>
    <property name="line-comment-start">//</property>
    <property name="block-comment-start">/*</property>
    <property name="block-comment-end">*/</property>
  </metadata>

  <styles>
    <style id="error" name="Error" map-to="def:error"/>
    <style id="external" name="External" map-to="def:preprocessor"/>
    <style id="comment" name="Comment" map-to="def:comment"/>
    <style id="string" name="String" map-to="def:string"/>
    <style id="escaped-character" name="Escaped Character" map-to="def:special-char"/>
    <style id="declaration" name="Declaration" map-to="def:type"/>
    <style id="modifier" name="Modifier" map-to="def:type"/>
    <style id="keyword" name="Keyword" map-to="def:keyword"/>
    <style id="special" name="Special Constant" map-to="def:special-constant"/>
    <style id="number" name="Number" map-to="def:decimal"/>
    <style id="operator" name="Operator" map-to="def:operator"/>
    <style id="type" name="Data Type" map-to="def:identifier"/>
    <style id="builtin" name="Built In" map-to="def:type"/>
    <style id="other" name="Other" map-to="def:special-char"/>
    <style id="xmltag" name="XML Tag" map-to="def:identifier"/>
  </styles>

  <definitions>
    <define-regex id="escaped-character" extended="true">
      \\(               # leading backslash
      [\\\"\'nrbtf] |   # escaped character
      [0-9]{1,3}    |   # latin encoded char
      u[0-9]{1,4}       # unicode char
      )
    </define-regex>

    <context id="string" style-ref="string" end-at-line-end="true" class="string" class-disabled="no-spell-check">
      <start>"</start>
      <end>"</end>
      <include>
      <context id="escaped-character" style-ref="escaped-character">
        <match>\%{escaped-character}</match>
      </context>
      </include>
    </context>

    <context id="multiline-string" style-ref="string" end-at-line-end="false" class="string" class-disabled="no-spell-check">
      <start>"""</start>
      <end>"""</end>
    </context>

    <context id="operators" style-ref="operator" extend-parent="false">
      <match>[-.~^@,;:/%|\=\+\*\!\?&amp;&lt;&gt;()_\[\]]</match>
    </context>

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

    <context id="character-error" style-ref="error">
      <match>'(\%{escaped-character}|.)[^\s]+'</match>
    </context>

    <context id="symbol" style-ref="special">
      <match>'[a-zA-Z_][a-zA-Z0-9_]*</match>
    </context>

    <context id="block-comment" style-ref="comment">
      <start>/\*</start>
      <end>\*/</end>
      <include>
        <context ref="def:in-comment"/>
        <context ref="block-comment"/>
      </include>
    </context>

    <context id="numeric" style-ref="number">
      <match extended="true">
        (\b([0-9]+|0[xX][0-9a-fA-F]+)[Ll]?\b|\b(([0-9]+[Ee][-]?[0-9]+|([0-9]*\.[0-9]+|[0-9]+\.)([Ee][-]?[0-9]+)?)[fFdD]?|[0-9]+[FfDd]))
      </match>
    </context>

    <context id="annotation">
      <match>(^\s*|[^a-zA-Z0-9_\s]\s*)(@[a-zA-Z][a-zA-Z0-9_]*)</match>
      <include>
        <context sub-pattern="2" style-ref="special"/>
      </include>
    </context>

    <context id="xmltag">
      <match>(&lt;/?\w+)(\s(\w+\=)\{.*\})*(/?&gt;)</match>
      <include>
        <context sub-pattern="1" style-ref="xmltag" />
        <context sub-pattern="3" style-ref="xmltag" />
        <context sub-pattern="4" style-ref="xmltag" />
      </include>
    </context>

    <context id="literal-identifier">
      <start>`</start>
      <end>`</end>
    </context>

    <context id="external" style-ref="external">
      <keyword>import</keyword>
      <keyword>package</keyword>
    </context>

    <context id="declaration" style-ref="declaration">
      <keyword>case class</keyword>
      <keyword>class</keyword>
      <keyword>def</keyword>
      <keyword>extends</keyword>
      <keyword>forSome</keyword>
      <keyword>mixin</keyword>
      <keyword>object</keyword>
      <keyword>trait</keyword>
      <keyword>type</keyword>
      <keyword>val</keyword>
      <keyword>var</keyword>
      <keyword>with</keyword>
    </context>

    <context id="primitive-type" style-ref="type">
      <keyword>Boolean</keyword>
      <keyword>Byte</keyword>
      <keyword>Char</keyword>
      <keyword>Double</keyword>
      <keyword>Float</keyword>
      <keyword>Int</keyword>
      <keyword>Long</keyword>
      <keyword>Short</keyword>
      <keyword>Unit</keyword>
    </context>

    <context id="library-type" style-ref="type">
      <!-- collection types //-->
      <keyword>Iterator</keyword>
      <keyword>Array</keyword>
      <keyword>String</keyword>
      <keyword>IterableProxy</keyword>
      <keyword>SeqProxy</keyword>
      <keyword>TraversableProxy</keyword>

      <!-- general //-->
      <keyword>Cell</keyword>
      <keyword>Option</keyword>
      <keyword>Some</keyword>
      <keyword>None</keyword>
      <keyword>Either</keyword>
      <keyword>Left</keyword>
      <keyword>Right</keyword>
      <keyword>Nil</keyword>
      <keyword>Null</keyword>
      <keyword>Nothing</keyword>
      <keyword>Class</keyword>
      <keyword>Any</keyword>
      <keyword>AnyVal</keyword>
      <keyword>AnyRef</keyword>
      <keyword>Pair</keyword>
      <keyword>Triple</keyword>
      <keyword>BigDecimal</keyword>
      <keyword>BigInt</keyword>

      <!-- immutable collections //-->
      <keyword>BitSet</keyword>
      <keyword>DefaultMap</keyword>
      <keyword>HashMap</keyword>
      <keyword>HashSet</keyword>
      <keyword>IndexedSeq</keyword>
      <keyword>IntMap</keyword>
      <keyword>Iterable</keyword>
      <keyword>LinearSeq</keyword>
      <keyword>List</keyword>
      <keyword>ListMap</keyword>
      <keyword>ListSet</keyword>
      <keyword>LongMap</keyword>
      <keyword>Map</keyword>
      <keyword>MapLike</keyword>
      <keyword>MapProxy</keyword>
      <keyword>Nil</keyword>
      <keyword>NumericRange</keyword>
      <keyword>RangeUtils</keyword>
      <keyword>PagedSeq</keyword>
      <keyword>Queue</keyword>
      <keyword>Range</keyword>
      <keyword>RedBlack</keyword>
      <keyword>Seq</keyword>
      <keyword>Set</keyword>
      <keyword>SetProxy</keyword>
      <keyword>SortedMap</keyword>
      <keyword>SortedSet</keyword>
      <keyword>Stack</keyword>
      <keyword>Stream</keyword>
      <keyword>StreamIterator</keyword>
      <keyword>StreamView</keyword>
      <keyword>StreamViewLike</keyword>
      <keyword>StringLike</keyword>
      <keyword>StringOps</keyword>
      <keyword>Traversable</keyword>
      <keyword>TreeMap</keyword>
      <keyword>TreeSet</keyword>
      <keyword>Vector</keyword>
      <keyword>VectorBuilder</keyword>
      <keyword>VectorIterator</keyword>
      <keyword>WrappedString</keyword>

      <!-- mutable collections //-->
      <keyword>AddingBuilder</keyword>
      <keyword>ArrayBuffer</keyword>
      <keyword>ArrayBuilder</keyword>
      <keyword>ArrayLike</keyword>
      <keyword>ArrayOps</keyword>
      <keyword>ArraySeq</keyword>
      <keyword>ArrayStack</keyword>
      <keyword>BitSet</keyword>
      <keyword>Buffer</keyword>
      <keyword>BufferLike</keyword>
      <keyword>BufferProxy</keyword>
      <keyword>Builder</keyword>
      <keyword>Cloneable</keyword>
      <keyword>ConcurrentMap</keyword>
      <keyword>DefaultEntry</keyword>
      <keyword>DefaultMapModel</keyword>
      <keyword>DoubleLinkedList</keyword>
      <keyword>DoubleLinkedListLike</keyword>
      <keyword>FlatHashTable</keyword>
      <keyword>GrowingBuilder</keyword>
      <keyword>HashEntry</keyword>
      <keyword>HashMap</keyword>
      <keyword>HashSet</keyword>
      <keyword>HashTable</keyword>
      <keyword>History</keyword>
      <keyword>ImmutableMapAdaptor</keyword>
      <keyword>ImmutableSetAdaptor</keyword>
      <keyword>IndexedSeq</keyword>
      <keyword>IndexedSeqLike</keyword>
      <keyword>IndexedSeqOptimized</keyword>
      <keyword>IndexedSeqView</keyword>
      <keyword>Iterable</keyword>
      <keyword>LazyBuilder</keyword>
      <keyword>LinearSeq</keyword>
      <keyword>LinkedEntry</keyword>
      <keyword>LinkedHashMap</keyword>
      <keyword>LinkedHashSet</keyword>
      <keyword>LinkedList</keyword>
      <keyword>LinkedListLike</keyword>
      <keyword>ListBuffer</keyword>
      <keyword>ListMap</keyword>
      <keyword>Map</keyword>
      <keyword>MapBuilder</keyword>
      <keyword>MapLike</keyword>
      <keyword>MapProxy</keyword>
      <keyword>MultiMap</keyword>
      <keyword>MutableList</keyword>
      <keyword>ObservableBuffer</keyword>
      <keyword>ObservableMap</keyword>
      <keyword>ObservableSet</keyword>
      <keyword>OpenHashMap</keyword>
      <keyword>PriorityQueue</keyword>
      <keyword>PriorityQueueProxy</keyword>
      <keyword>Publisher</keyword>
      <keyword>Queue</keyword>
      <keyword>QueueProxy</keyword>
      <keyword>ResizableArray</keyword>
      <keyword>RevertibleHistory</keyword>
      <keyword>Seq</keyword>
      <keyword>SeqLike</keyword>
      <keyword>Set</keyword>
      <keyword>SetBuilder</keyword>
      <keyword>SetLike</keyword>
      <keyword>SetProxy</keyword>
      <keyword>Stack</keyword>
      <keyword>StackProxy</keyword>
      <keyword>StringBuilder</keyword>
      <keyword>Subscriber</keyword>
      <keyword>SynchronizedBuffer</keyword>
      <keyword>SynchronizedMap</keyword>
      <keyword>SynchronizedPriorityQueue</keyword>
      <keyword>SynchronizedQueue</keyword>
      <keyword>SynchronizedSet</keyword>
      <keyword>SynchronizedStack</keyword>
      <keyword>Traversable</keyword>
      <keyword>Undoable</keyword>
      <keyword>UnrolledBuffer</keyword>
      <keyword>WeakHashMap</keyword>
      <keyword>WrappedArray</keyword>
      <keyword>WrappedArrayBuilder</keyword>
    </context>

    <context id="modifier" style-ref="modifier">
      <keyword>abstract</keyword>
      <keyword>final</keyword>
      <keyword>implicit</keyword>
      <keyword>lazy</keyword>
      <keyword>override</keyword>
      <keyword>private</keyword>
      <keyword>protected</keyword>
      <keyword>sealed</keyword>
    </context>

    <context id="flow" style-ref="keyword">
      <keyword>case</keyword>
      <keyword>catch</keyword>
      <keyword>do</keyword>
      <keyword>else</keyword>
      <keyword>finally</keyword>
      <keyword>for</keyword>
      <keyword>if</keyword>
      <keyword>match</keyword>
      <keyword>requires</keyword>
      <keyword>return</keyword>
      <keyword>throw</keyword>
      <keyword>try</keyword>
      <keyword>while</keyword>
      <keyword>yield</keyword>
    </context>

    <context id="memory" style-ref="keyword">
      <keyword>new</keyword>
      <keyword>super</keyword>
      <keyword>this</keyword>
    </context>

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


    <context id="scala" class="no-spell-check">
      <include>
        <context ref="literal-identifier"/>
        <context ref="multiline-string"/>
        <context ref="string"/>
        <context ref="character"/>
        <context ref="character-error"/>
        <context ref="symbol"/>
        <context ref="def:c-like-comment"/>
        <context ref="block-comment"/>
        <context ref="def:c-like-close-comment-outside-comment"/>
        <context ref="annotation"/>
        <context ref="external"/>
        <context ref="declaration"/>
        <context ref="primitive-type"/>
        <context ref="library-type"/>
        <context ref="modifier"/>
        <context ref="flow"/>
        <context ref="memory"/>
        <context ref="special"/>
        <context ref="numeric"/>
        <context ref="xmltag"/>
        <context ref="operators"/>
      </include>
    </context>

  </definitions>
</language>