syntax highlighting for text editors using gtksourceview

127 views
Skip to first unread message

delfick755

unread,
Nov 11, 2009, 9:33:52 PM11/11/09
to golang-nuts
Hello,

Can someone make a syntax file for gtksourceview please

http://library.gnome.org/devel/gtksourceview-2.0/stable/lang-reference.html
http://library.gnome.org/devel/gtksourceview-2.0/stable/lang-tutorial.html

So text editors using gtksourceview can have syntax highlighting (i.e.
gedit, scribes, etc)

Thankyou

Regards
Stephen

Javier Pérez

unread,
Nov 13, 2009, 9:02:49 AM11/13/09
to golang-nuts
Hello,

I wrote my own go.lang from c.lang file
http://91.121.30.198/static/go/go.lang

Copy that file into /usr/share/gtksourceview-2.0/language-specs/

I will appreciate any input.

Regards,
Javier Pérez

On 12 nov, 03:33, delfick755 <delfick...@gmail.com> wrote:
> Hello,
>
> Can someone make a syntax file for gtksourceview please
>
> http://library.gnome.org/devel/gtksourceview-2.0/stable/lang-referenc...http://library.gnome.org/devel/gtksourceview-2.0/stable/lang-tutorial...
>
> So text editors using gtksourceview can have syntax highlighting (i.e.gedit, scribes, etc)
>
> Thankyou
>
> Regards
> Stephen

Diego Sarmentero

unread,
Nov 13, 2009, 9:19:13 AM11/13/09
to Javier Pérez, golang-nuts
Great!! Thanks!
--
Desgraciadamente Nuestra Tecnología Ha Superado Nuestra Humanidad.

-Albert Einstein-

Tonic Artos

unread,
Nov 13, 2009, 9:43:07 AM11/13/09
to Javier Pérez, golang-nuts
El 13 de noviembre de 2009 11:02, Javier Pérez <javier....@gmail.com>
escribió:

> Hello,
>
> I wrote my own go.lang from c.lang file
> http://91.121.30.198/static/go/go.lang
>
> Copy that file into /usr/share/gtksourceview-2.0/language-specs/

You can actually put it into ~/.local/share/gtksourceview-2.0/language-specs/

I have also made one and posted it to the gtksourceview folks for
review http://mail.gnome.org/archives/gnome-devtools/2009-November/msg00000.html.
Didn't realise it had been requested here. It is a little late here
(3:30am) so tomorrow I will compare differences between mine and
yours. A cursory look indicates you have also started with the c.lang
spec as a base :)

Tonic

delfick755

unread,
Nov 13, 2009, 7:11:47 PM11/13/09
to golang-nuts
Thankyou both :)

2009/11/13 Tonic Artos <ghata...@gmail.com>:
> Didn't realise it had been requested here. It is a little late here
> (3:30am)

That's alright, all that matters is quality syntax highlighting at the
end :p

Tonic Artos

unread,
Nov 13, 2009, 9:31:56 PM11/13/09
to delfick755, golang-nuts
Okay so I noticed a difference where Javier is using storage-class for
const, map and chan. I however have them only as keywords as per the
language specification on golang.org. Not sure which is best here for
the purpose of highlighting, but var, struct and type probably belong
with const, map and chan. Also, I would think adding [] and "" to the
group would be useful.

In implementing the gtksourceview lang spec I stuck close to the
language specification on golang.org. However I separated out the
deprecated built-in functions panic* and print* as well as goto to be
highlighted as errors. I also added some funky error indication to
string and char literals, highlighting invalid escapes, overfull char
literals and unfinished literals. Also I've included most of the \x \u
\U differences from C (for string and char literals) but I only now
noticed I've forgotten to update this for numbers.

Tonic

uriel

unread,
Nov 14, 2009, 11:57:24 PM11/14/09
to golang-nuts
I have started to collect syntax files for various text editors:
http://go-lang.cat-v.org/text-editors/

There are already three for gtksourceview: http://go-lang.cat-v.org/text-editors/gedit/

If anyone has more Go syntax files for other editors, send me a copy
and I will be happy to add it to the collection.

uriel

On Nov 12, 3:33 am, delfick755 <delfick...@gmail.com> wrote:
> Hello,
>
> Can someone make a syntax file for gtksourceview please
>
> http://library.gnome.org/devel/gtksourceview-2.0/stable/lang-referenc...http://library.gnome.org/devel/gtksourceview-2.0/stable/lang-tutorial...
>
> So text editors using gtksourceview can have syntax highlighting (i.e.gedit, scribes, etc)
>
> Thankyou
>
> Regards
> Stephen

Russ Cox

unread,
Nov 15, 2009, 12:07:55 AM11/15/09
to uriel, golang-nuts
On Sat, Nov 14, 2009 at 20:57, uriel <ur...@berlinblue.org> wrote:
> I have started to collect syntax files for various text editors:
> http://go-lang.cat-v.org/text-editors/
>
> There are already three for gtksourceview: http://go-lang.cat-v.org/text-editors/gedit/
>
> If anyone has more Go syntax files for other editors, send me a copy
> and I will be happy to add it to the collection.

Even better, see http://golang.org/doc/contribute.html
to add it to the Go repository proper.

Russ

EruJAZZ

unread,
Nov 16, 2009, 12:14:13 PM11/16/09
to golang-nuts
very thx =)
Reply all
Reply to author
Forward
0 new messages