bug-zile
[Top][All Lists]
Advanced

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

[Bug-zile] Syntax Highlighting


From: Gary V. Vaughan
Subject: [Bug-zile] Syntax Highlighting
Date: Tue, 10 Jan 2012 16:00:33 +0700

Hi Reuben,

So, I've been playing with a syntax highlighting engine in zi.. it currently
only colors a hardcoded expression for matching lua comments in red, but
also allows the status bar and minibuffer to by "themed" in different colors.
I don't really think much of the emacs syntax highlighter, since it is complex
and doesn't even allow nested modes (like shell code in a configure.ac, or
more popularly javascript and php embedded in an html file) and as such I'm
basing the engine on the way TextMate does it... in the first instance because
writing new modes is a lot easier for TextMate than for Emacs, but also because
there are a ton of TextMate modes already available that it should be easy to
write an importer to.

Before I spend too much time tearing off on this tangent, do you forsee any
scope for sharing some or all of this functionality with the lua branch proper?

I can't say off the bat whether it would be easier to collaborate on some kind
of Emacs lisp font-lock support on lua with the bulk of the highlighting engine
itself implemented in lua and shared between the zi and lua branches, but it
seems like we should explore the possibility of doing that so that both branches
can benefit...

Some initial thoughts:

1. The TextMate highlighting is controlled by a restartable oniguruma(sp?)
   regex parser over a series of context changes tagged as line offsets (the
   resulting contexts are useful for other stuff too, like having a key chord
   do something different in a nested php section than the surrounding html,
   for say code completion on TAB - but I'm getting off topic).  If it's going
   to be possible to import a TextMate bundle (their name for a mode) auto-
   matically, then I'll need to use a compatible regexp parser, but I was
   also happy to remove the dependency on the rex-gnu lua module, because it's
   so difficult to install correctly, so I'm also prepared to require a
   separate manual conversion and use LPEG or something to parse the TextMate
   bundle files.
2. I quite like the purity of having zi written in lua only (with lposix at
   least until ffi calls are implemented), so I don't know whether it's
   worth trying too much to shy away from additional dependencies like LPEG
   if it's possible to make it work without.  Then again, ISTR you think that
   the best way to get satisfactory performance out of the file buffers is to
   write them as a lua module in C.  At that point, we'll have compiled code
   in Zile again, and I think it might be worth trying to make Zile a self-
   contained package again: shipping it's own lua sources and luastd, so that
   it can be built easily again?

Cheers,
-- 
Gary V. Vaughan (gary AT gnu DOT org)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]