GtkSourceView: Eiffel Syntax Highlighting



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi people,

I'm not sure if I'm writing to the right mailing list, if not I'm sorry
for the annoyance. I'm busy writing an XML parser in Eiffel and missed
the syntax highlighting for this language in gedit.

Have therefore written a non-exhaustive but already useful language spec
and wanted it to share for the next gtksourceview version; hope it will
be useful for other Eiffel developers.


Thx,

~ - Hasan Karahan.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHmeYtQoMvaHvefp4RAnnoAKCLezz+l6jZq12AT8WP3NyZrQpwdACglgra
9MSfimrpbuob8bowj0O3d60=
=uiX3
-----END PGP SIGNATURE-----
<?xml version="1.0" encoding="UTF-8"?>
<!--

 Author: Hasan Karahan <hasan karahan81 gmail com>
 Copyright (C) 2008 Hasan Karahan <hasan karahan81 gmail com>

 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="eiffel" _name="Eiffel" version="2.0" _section="Sources">

    <metadata>
        <property name="mimetypes">text/x-eiffel</property>
        <property name="globs">*.e;*.eif</property>
        <property name="line-comment-start">--</property>
    </metadata>

    <styles>
    <style id="comment" _name="Comment"          map-to="def:comment"/>
    <style id="string"  _name="String"           map-to="def:string"/>
    <style id="keyword" _name="Keyword"          map-to="def:keyword"/>
    <style id="decimal" _name="Decimal"          map-to="def:decimal"/>
    <style id="type"    _name="Data Type"        map-to="def:type"/>
    <style id="builtin" _name="Builtin Function" map-to="def:builtin"/>
    </styles>

    <definitions>

    <context id="single-quoted-string" style-ref="string">
        <start>'</start>
        <end>'</end>
    </context>

    <context id="double-quoted-string" style-ref="string">
        <start>"</start>
        <end>"</end>
    </context>

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

    <context id="keywords" style-ref="keyword">
        <keyword>indexing</keyword>
        <keyword>class</keyword>
        <keyword>inherit</keyword>
        <keyword>redefine</keyword>
        <keyword>undefine</keyword>
        <keyword>rename</keyword>
        <keyword>export</keyword>
        <keyword>all</keyword>
        <keyword>create</keyword>
        <keyword>feature</keyword>
        <keyword>features</keyword>
        <keyword>is</keyword>
        <keyword>do</keyword>
        <keyword>end</keyword>
        <keyword>local</keyword>
        <keyword>if</keyword>
        <keyword>when</keyword>
        <keyword>then</keyword>
        <keyword>elseif</keyword>
        <keyword>else</keyword>
        <keyword>not</keyword>
        <keyword>and</keyword>
        <keyword>or</keyword>
        <keyword>from</keyword>
        <keyword>variant</keyword>
        <keyword>until</keyword>
        <keyword>loop</keyword>
        <keyword>once</keyword>
        <keyword>like</keyword>
        <keyword>as</keyword>
        <keyword>alias</keyword>
        <keyword>deferred</keyword>
        <keyword>inspect</keyword>
        <keyword>expand</keyword>
        <keyword>interface</keyword>
        <keyword>exported</keyword>
    </context>

    <context id="design-by-contract" style-ref="keyword">
        <keyword>require</keyword>
        <keyword>ensure</keyword>
        <keyword>invariant</keyword>
        <keyword>implies</keyword>
    </context>

    <context id="exception-handling" style-ref="keyword">
        <keyword>raise</keyword>
        <keyword>rescue</keyword>
        <keyword>retry</keyword>
    </context>

    <context id="builtin-refs" style-ref="keyword">
        <keyword>Current</keyword>
        <keyword>Precursor</keyword>
        <keyword>Result</keyword>
    </context>

    <context id="builtin-functions" style-ref="keyword">
        <keyword>check</keyword>
        <keyword>debug</keyword>
        <keyword>abort</keyword>
    </context>

    <context id="builtin-types" style-ref="type">
        <keyword>CHARACTER</keyword>
        <keyword>STRING</keyword>
        <keyword>BOOLEAN</keyword>
        <keyword>REAL</keyword>
        <keyword>INTEGER</keyword>
        <keyword>NONE</keyword>
        <keyword>ANY</keyword>
    </context>

    <context id="builtin-values" style-ref="keyword">
        <keyword>Void</keyword>
        <keyword>False</keyword>
        <keyword>True</keyword>
    </context>

    <context id="lib-eiffel-base" style-ref="type">
        <keyword>ACTIVE</keyword>
        <keyword>ARRAYED_LIST_CURSOR</keyword>
        <keyword>ARRAYED_LIST</keyword>
        <keyword>ARRAYED_STACK</keyword>
        <keyword>BILINEAR</keyword>
        <keyword>BI_LINKABLE</keyword>
        <keyword>CELL</keyword>
        <keyword>CONTAINER</keyword>
        <keyword>COUNTABLE</keyword>
        <keyword>CURSOR</keyword>
        <keyword>DYNAMIC_LIST</keyword>
        <keyword>HASH_TABLE_CURSOR</keyword>
        <keyword>HASH_TABLE</keyword>
        <keyword>INDEXABLE</keyword>
        <keyword>LINEAR</keyword>
        <keyword>LINKABLE</keyword>
        <keyword>LINKED_LIST_CURSOR</keyword>
        <keyword>LINKED_LIST</keyword>
        <keyword>LINKED_QUEUE</keyword>
        <keyword>LINKED_STACK</keyword>
        <keyword>LIST</keyword>
        <keyword>QUEUE</keyword>
        <keyword>RESIZABLE</keyword>
        <keyword>SEQUENCE</keyword>
        <keyword>SET</keyword>
        <keyword>STACK</keyword>
        <keyword>TWO_WAY_LIST_CURSOR</keyword>
        <keyword>TWO_WAY_LIST</keyword>
        <keyword>UNBOUNDED</keyword>
    </context>

    <context id="lib-eiffel-time" style-ref="type">
        <keyword>ABSOLUTE</keyword>
        <keyword>DATE_CONSTANTS</keyword>
        <keyword>DATE_DURATION</keyword>
        <keyword>DATE</keyword>
        <keyword>DATE_TIME_CONSTANTS</keyword>
        <keyword>DATE_TIME_DURATION</keyword>
        <keyword>DATE_TIME</keyword>
        <keyword>DATE_TIME_VALUE</keyword>
        <keyword>DATE_VALUE</keyword>
        <keyword>DURATION</keyword>
        <keyword>TIME_CONSTANTS</keyword>
        <keyword>TIME_DURATION</keyword>
        <keyword>TIME</keyword>
        <keyword>TIME_VALUE</keyword>
    </context>

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

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

    <context id="eiffel">
        <include>
            <context ref="single-quoted-string"/>
            <context ref="double-quoted-string"/>
            <context ref="line-comment"/>
            <context ref="keywords"/>
            <context ref="design-by-contract"/>
            <context ref="exception-handling"/>
            <context ref="builtin-refs"/>
            <context ref="builtin-functions"/>
            <context ref="builtin-types"/>
            <context ref="builtin-values"/>
            <context ref="lib-eiffel-base"/>
            <context ref="lib-eiffel-time"/>
            <context ref="number"/>
            <context ref="hex-number"/>
        </include>
    </context>

    </definitions>
</language>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]