all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Deniz Dogan <deniz.a.m.dogan@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Own programming language mode - syntax highlighting
Date: Tue, 14 Sep 2010 13:15:33 +0200	[thread overview]
Message-ID: <AANLkTi=CtXujVxY5g-C-6qxVRAdFR_zT4vwPG5=SRbiH@mail.gmail.com> (raw)
In-Reply-To: <i6nir6$30m$1@dough.gmane.org>

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



  parent reply	other threads:[~2010-09-14 11:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-14 10:29 Own programming language mode - syntax highlighting Gary
2010-09-14 11:11 ` Oleksandr Gavenko
2010-09-14 11:15 ` Deniz Dogan [this message]
2010-09-14 11:43   ` Oleksandr Gavenko
     [not found] <mailman.11.1284460213.12957.help-gnu-emacs@gnu.org>
2010-09-14 22:19 ` Tim X

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=CtXujVxY5g-C-6qxVRAdFR_zT4vwPG5=SRbiH@mail.gmail.com' \
    --to=deniz.a.m.dogan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.