[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: font-lock regexp for complementary keywords
From: |
David Combs |
Subject: |
Re: font-lock regexp for complementary keywords |
Date: |
Sun, 13 Aug 2006 18:37:20 +0000 (UTC) |
In article <mailman.4451.1153844221.9609.help-gnu-emacs@gnu.org>,
Kevin Rodgers <ihs_4664@yahoo.com> wrote:
>Dieter Wilhelm wrote:
>> Hi
>>
>> I'd like to fontify Ansys keywords. The solver accepts unique short
>> forms of the command keywords, the rest is ignored. For example the
>> uniqe part of `/filname' is `/fil' and I'd like to fontify
>>
>> /fil and
>> /filn and
>> /filna and
>> /filnam and
>> /filname and
>>
>> as well. The only idea I got so far is to do it in 5 separate
>> font-lock statements:
>>
>> \\(/fil\\) 1 font-lock...
>> /fil\\(n\\) 1 fon...
>> /filn\\(a\\) 1 ...
>> /filna\\(m\\) 1 ...
>> /filnam\\(e\\) 1 ...
>
>Why are you grouping and highlighting either "/fil" or the last letter?
>
>> Very ugly and inefficient, isn't it?
>> Originally I thought that something like this
>>
>> /fil\\(n\\|na\\|nam\\|name\\)
>>
>> would work but rexexp-bulider doesn't show any matches for the
>> complementing alternatives.
>
>"/fil\\(n\\(a\\(me?\\)?\\)?\\)?\\>" 0 font-lock...
A really-stupid question:
That last line -- were it not elisp but eg postscript (or reverse polish),
I'd at least understand the syntax: font-lock would (likely) take at least
two args (would get stacked) and then font-lock (op) would would run.
But this *is* elisp, so just what is that expression? It clearly
must be some part of a bigger expression, form, whatever. Perhaps
you could show an example?
Thanks!
David
- Re: font-lock regexp for complementary keywords,
David Combs <=