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

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

Re: Own programming language mode - syntax highlighting


From: Deniz Dogan
Subject: Re: Own programming language mode - syntax highlighting
Date: Tue, 14 Sep 2010 13:15:33 +0200

2010/9/14 Gary <help-gnu-emacs@garydjones.name>:
> Following Xah Lee's excellent tutorial, I have been able to get the
> basics done - syntax highlighting, indentation, and so on. What I am
> missing is a small part of the syntax highlighting related to variables.
>
> Declarations work fine - for example
> int x = 0
> is correctly highlighted. What I can't work out how to do is to
> highlight declared variables in the rest of the code, for example when I
> later use x such as
> x = x+1
>
> Does anyone have any ideas? Ideally I'd like to only highlight those
> variables I have really declared, not something that just looks like it
> *might* be a variable, so I can see immediately if I've made a mistake
> in my coding or typing.
>

To do this in a sensible way you need a real parser, which can be
implemented using e.g. Semantic[1]. Simple regular expressions and
such cannot be used for this purpose in a sensible way.

1: http://cedet.sourceforge.net/semantic.shtml

-- 
Deniz Dogan



reply via email to

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