After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 576141 - Genie syntax highlighting
Genie syntax highlighting
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: Syntax files
git master
Other All
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2009-03-21 00:01 UTC by sanpi
Modified: 2015-02-21 09:40 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
genie.lang (6.82 KB, application/xml)
2009-03-21 00:02 UTC, sanpi
Details
genie.lang (7.88 KB, application/xml)
2009-03-21 14:01 UTC, sanpi
Details

Description sanpi 2009-03-21 00:01:30 UTC
I have written a .lang file for the genie language: http://live.gnome.org/Genie
Comment 1 sanpi 2009-03-21 00:02:17 UTC
Created attachment 131057 [details]
genie.lang
Comment 2 Ignacio Casal Quinteiro (nacho) 2009-03-21 00:31:22 UTC
Is the mime type in the shared-mime-info database? If not could you file a bug against freedesktop so they can include that mime type?
Comment 3 Ignacio Casal Quinteiro (nacho) 2009-03-21 00:34:23 UTC
More things: Having a look at genie page seems it supports something like the printf params (%d, %s ...) if they are the same as in c you could make a ref to c:printf so you get that those params highlighted.
Comment 4 sanpi 2009-03-21 02:06:52 UTC
I have posted on freedesktop for add the mime type: https://bugs.freedesktop.org/show_bug.cgi?id=20783

I updated the attachment with a file from the vala mailing list and added printf highlighting.
Comment 5 sanpi 2009-03-21 02:08:56 UTC
Comment on attachment 131057 [details]
genie.lang

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

 Author: Jamie McCracken jamiemcc gnome org
 Copyright (C) 2008 Jamie McCracken jamiemcc gnome org

 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="genie" _name="Genie" version="2.0" _section="Sources">
  <metadata>
    <property name="mimetypes">text/x-gs</property>
    <property name="globs">*.gs</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="multiline-string" _name="Multiline string" map-to="def:string"/>
    <style id="string" _name="String" map-to="def:string"/>
    <style id="regex" _name="Regular Expression" map-to="def:string"/>
    <style id="namespace" _name="Namespace" map-to="def:preprocessor"/>
    <style id="type" _name="Data Type" map-to="def:type"/>
    <style id="definition" _name="Definition" map-to="def:keyword"/>
    <style id="keyword" _name="Keyword" map-to="def:keyword"/>
    <style id="special-variable"     _name="Special Variable"      map-to="def:identifier"/>
    <style id="null-value" _name="Null Value" map-to="def:special-constant"/>
    <style id="boolean" _name="Boolean" map-to="def:boolean"/>
    <style id="number" _name="Number" map-to="def:number"/>
    <style id="builtin" _name="Builtin Function" map-to="def:builtin"/>
    <style id="printf" _name="printf Conversion" map-to="def:special-char"/>
  </styles>

  <definitions>

    <context id="printf" style-ref="printf" extend-parent="false">
        <match extended="true">
            \%\%|\%
            (?:[1-9][0-9]*\$)?      # argument
            [#0\-\ \+\'I]*          # flags
            (?:[1-9][0-9]*|\*)?     # width
            (?:\.\-?(?:[0-9]+|\*))? # precision
            (?:hh|ll|[hlLqjzt])?    # length modifier
            [diouxXeEfFgGaAcsCSpnm] # conversion specifier
        </match>
    </context>

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

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

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

    <context id="double-quoted-string" style-ref="string" end-at-line-end="true">
      <start>"</start>
      <end>"</end>
      <include>
        <context ref="printf"/>
        <context ref="def:escape"/>
        <context ref="def:line-continue"/>
      </include>
    </context>

    <context id="single-quoted-string" style-ref="string" end-at-line-end="true">
      <start>'</start>
      <end>'</end>
      <include>
        <context ref="def:escape"/>
        <context ref="def:line-continue"/>
      </include>
    </context>

    <context id="regex" style-ref="regex" end-at-line-end="true">
      <start>/(?!/)</start>
      <end>/</end>
    </context>

    <context id="namespace" style-ref="namespace">
      <keyword>uses</keyword>
      <keyword>namespace</keyword>
    </context>

    <context id="primitives" style-ref="type">
      <keyword>bool</keyword>
      <keyword>byte</keyword>
      <keyword>char</keyword>
      <keyword>date</keyword>
      <keyword>datetime</keyword>
      <keyword>decimal</keyword>
      <keyword>double</keyword>
      <keyword>float</keyword>
      <keyword>int</keyword>
      <keyword>long</keyword>
      <keyword>object</keyword>
      <keyword>sbyte</keyword>
      <keyword>short</keyword>
      <keyword>single</keyword>
      <keyword>string</keyword>
      <keyword>ulong</keyword>
      <keyword>ushort</keyword>
    </context>

    <context id="definitions" style-ref="definition">

      <keyword>const</keyword>
      <keyword>class</keyword>
      <keyword>construct</keyword>
      <keyword>def</keyword>
      <keyword>delegate</keyword>
      <keyword>enum</keyword>
      <keyword>exception</keyword>
      <keyword>extern</keyword>
      <keyword>event</keyword>
      <keyword>final</keyword>
      <keyword>get</keyword>
      <keyword>init</keyword>
      <keyword>inline</keyword>
      <keyword>interface</keyword>
      <keyword>override</keyword>
      <keyword>prop</keyword>
      <keyword>return</keyword>
      <keyword>set</keyword>
      <keyword>static</keyword>
      <keyword>struct</keyword>
      <keyword>var</keyword>
      <keyword>virtual</keyword>
      <keyword>weak</keyword>
    </context>

    <context id="keywords" style-ref="keyword">
      <keyword>abstract</keyword>
      <keyword>as</keyword>
      <keyword>and</keyword>
      <keyword>break</keyword>
      <keyword>case</keyword>
      <keyword>cast</keyword>
      <keyword>continue</keyword>
      <keyword>default</keyword>
      <keyword>delete</keyword>
      <keyword>div</keyword>
      <keyword>do</keyword>
      <keyword>downto</keyword>
      <keyword>dynamic</keyword>
      <keyword>else</keyword>
      <keyword>ensures</keyword>
      <keyword>except</keyword>
      <keyword>extern</keyword>
      <keyword>finally</keyword>
      <keyword>for</keyword>
      <keyword>if</keyword>
      <keyword>implements</keyword>
      <keyword>in</keyword>
      <keyword>isa</keyword>
      <keyword>is</keyword>
      <keyword>lock</keyword>
      <keyword>new</keyword>
      <keyword>not</keyword>
      <keyword>of</keyword>
      <keyword>out</keyword>
      <keyword>or</keyword>
      <keyword>otherwise</keyword>
      <keyword>pass</keyword>
      <keyword>private</keyword>
      <keyword>raise</keyword>
      <keyword>raises</keyword>
      <keyword>readonly</keyword>
      <keyword>ref</keyword>
      <keyword>requires</keyword>
      <keyword>to</keyword>
      <keyword>try</keyword>
      <keyword>unless</keyword>
      <keyword>when</keyword>
      <keyword>while</keyword>
    </context>

    <context id="special-variables" style-ref="special-variable">
      <keyword>self</keyword>
      <keyword>super</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="numbers" style-ref="number">
      <match extended="true">
        (?&lt;![\w\.])
        [0-9][0-9\.]*(m|ms|d|h|s|f|F|l|L)?
        (?![\w\.])
      </match>
    </context>

    <context id="builtins" style-ref="builtin">
      <keyword>array</keyword>
      <keyword>assert</keyword>
      <keyword>dict</keyword>
      <keyword>list</keyword>
      <keyword>max</keyword>
      <keyword>min</keyword>
      <keyword>print</keyword>
      <keyword>prop</keyword>
      <keyword>sizeof</keyword>
      <keyword>typeof</keyword>
    </context>

    <context id="genie">
      <include>
        <context ref="def:shell-like-comment" style-ref="comment"/>
        <context ref="c-style-line-comment"/>
        <context ref="block-comment"/>
        <context ref="multiline-string"/>
        <context ref="double-quoted-string"/>
        <context ref="single-quoted-string"/>
        <context ref="regex"/>
        <context ref="namespace"/>
        <context ref="primitives"/>
        <context ref="definitions"/>
        <context ref="keywords"/>
        <context ref="special-variables"/>
        <context ref="null-value"/>
        <context ref="boolean"/>
        <context ref="numbers"/>
        <context ref="builtins"/>
      </include>
    </context>

  </definitions>
</language>
Comment 6 Ignacio Casal Quinteiro (nacho) 2009-03-21 10:09:49 UTC
There is no need to add the regex again, you could do:
<context id="double-quoted-string" style-ref="string"
end-at-line-end="true">
      <start>"</start>
      <end>"</end>
      <include>
        <context ref="c:printf"/>
        <context ref="def:escape"/>
        <context ref="def:line-continue"/>
      </include>
    </context>

BTW, could you provide an attachment instead of paste it into the comment?
Thanks for your work.
Comment 7 sanpi 2009-03-21 14:01:08 UTC
Created attachment 131082 [details]
genie.lang
Comment 8 sanpi 2009-03-21 14:02:31 UTC
(In reply to comment #6)
> There is no need to add the regex again, you could do:
> <context id="double-quoted-string" style-ref="string"
> end-at-line-end="true">
>       <start>"</start>
>       <end>"</end>
>       <include>
>         <context ref="c:printf"/>
>         <context ref="def:escape"/>
>         <context ref="def:line-continue"/>
>       </include>
>     </context>

The file is updated
Comment 9 Ignacio Casal Quinteiro (nacho) 2009-03-24 19:31:15 UTC
The file looks good to me, did you check that genie is supported by freedesktop shared-mime-info?
Comment 10 sanpi 2009-03-25 10:18:26 UTC
I have posted a request on freedesktop: https://bugs.freedesktop.org/show_bug.cgi?id=20783
Comment 11 Al Thomas 2015-02-19 15:47:52 UTC
The text/x-genie MIME type has been added to shared-mime-info v1.4

See commit:

http://cgit.freedesktop.org/xdg/shared-mime-info/commit/?id=b74a0cd3ef6a8cacd83ef43ff4814fff763c52f5
Comment 12 Paolo Borelli 2015-02-21 09:40:19 UTC
Ok, I finally went ahead and pushed this lang file (with a few changes)