GNOME Bugzilla – Bug 576141
Genie syntax highlighting
Last modified: 2015-02-21 09:40:19 UTC
I have written a .lang file for the genie language: http://live.gnome.org/Genie
Created attachment 131057 [details] genie.lang
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?
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.
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 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"> (?<![\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>
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.
Created attachment 131082 [details] genie.lang
(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
The file looks good to me, did you check that genie is supported by freedesktop shared-mime-info?
I have posted a request on freedesktop: https://bugs.freedesktop.org/show_bug.cgi?id=20783
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
Ok, I finally went ahead and pushed this lang file (with a few changes)