[Geany-devel] [Geany] cython language support

Sebastien Barthelemy barthelemy at xxxxx
Wed Jan 21 14:21:44 UTC 2009


2009/1/21 Enrico Tröger <enrico.troeger at uvena.de>:
> On Tue, 20 Jan 2009 16:20:48 +0100, Sebastien Barthelemy
> <barthelemy at crans.org> wrote:
>>- I added GEANY_FILETYPES_CYTHON to filetypes.{c,h}. I choosed
>>ft->lang = 7, but I'm not sure about it means ([2] doesn't mention it)
>
> src/filetypes.h line 128

/** Represents the langType of tagmanager (see the table
	 * in tagmanager/parsers.h), -1 represents all, -2 none. */

I saw this comment but I do not know what the tagmanager does yet.

> From what I have read in the IRC backlog, I don't see why another
> filetype is necessary at least for syntax highlighting.
> Either you want to reuse the Python lexer for highlighting(a), that
> would be pretty easy in src/highlighting.c or you have to write a new
> Scintilla lexer for Cython first(b).
>
> In case of (a): why would we need a new filetype at all?

there are keywords in Cython that are not keywords in Python. For
instance, "cdef int a = 0" is valid Cython but invalid Python. On the
contrary "cdef = 0" is valid python (where cdef is a regular var) but
invalid cython.

Yet, they are very similar, so the Python lexer should be ok, with
additionnal keywords. (I never wrote one, nor heard of them before
yesterday, so I might be wrong).

> Some example files would be helpful (something more complex than the
> snippet mentioned in IRC).

The sage project uses Cython a lot. For instance
http://www.sagemath.org/hg/sage-main/file/b0aa7ef45b3c/sage/rings/rational.pyx

regards

-- 
Sébastien Barthélemy



More information about the Devel mailing list