help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: State-machine based syntax highlighting


From: Robert Thorpe
Subject: Re: State-machine based syntax highlighting
Date: 7 Dec 2006 02:53:45 -0800
User-agent: G2/1.0

spamfilteraccount@gmail.com wrote:
> I just read that in the text editor FTE does syntax highlighting can be
> defined with state-machines.
>
> Here's a LUA example I found: http://t-o-m-e.net/tmp/m_lua.fte
>
> Does anyone know the dis/advantages of this method compared to the
> regexp-based emacs approach?

Regexp are state machines.  Or, to be more precise the regexp engine
compiles regexp it is given into discrete finite state machines.
Defining state machines manually is usually worse than generating them
from regexp normally, because a human cannot do the regexp
optimizations that the regexp engine can.

In my view the real way to improve Emacs syntax highlighting would be
to make it based on parsing.

> E.g. would it work faster than the current
> emacs implementation?

Do you have a problem with the speed of a regexp you have written?  If
so it's probably down to the regexp or the way you're trying to do
things.  Post the code here and someone may be able to help you.



reply via email to

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