[Top][All Lists]

[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 04:42:44 -0800
User-agent: G2/1.0

address@hidden wrote:
> Robert Thorpe wrote:
> >
> > In my view the real way to improve Emacs syntax highlighting would be
> > to make it based on parsing.
> >
> Yes, it could be better, though in this case emacs would rely on
> external tools doing the actual parsing, because I don't think the
> syntax parsing of every language should be reimplemented in elisp.
> That's not a big deal, since if I need to work with c files then
> usually have the c compiler installed.

No, it would probably have to be reimplemented inside Emacs.
There are many differences between parsing an language in order to
compile it and parsing a language in order to perform syntax
highlighting and movement commands.

In the later case you have to be able to tolerate expressions near to
point that are incorrectly formatted because the user is still typing
them.  Also you have to be able to trigger the process from any given
point, so that if the user jumps from line 1 to line 5794 you don't
have to parse everything in the intervening code.  Also, when
highlighting you don't care about the contents of the code much.

The Emacs "Semantic" package already does much of this, so do some
other editors.

reply via email to

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