Subject: Re: bug#1913: Identifier after reserved word "raise" is not always highlighted in Ada-mode

From: Erik <[email-masked]>
Date: Fri, 16 Jan 2009 00:03:13 +0100

Juanma Barranquero skrev:
> On Thu, Jan 15, 2009 at 14:40, Erik <[email-masked]> wrote:
>
>   
>> The patch is an improvement, but it highlights some illegal identifiers.
>>     
>
> That shouldn't be a problem. You don't use font-locking to determine
> whether the identifier follows Ada rules, do you? :-)
>   

Actually I do notice the highlighting and take advantage of it as an
early error detector. If it makes me notice an error immediately, before
I move on to another part of the code or try to compile things, it is
useful. If a word is not highlighted as expected when I have typed it, I
automatically stop to see what I did wrong.

>> (no leading, consecutive or trailing '_')
>>     
>
> Yes, I know the spec. But I don't think the problem of false positives
> is worth making the regexp slower.
>   

Did you have a performance problem with that regexp? I do not really
believe that there is a reason to worry about it without some
measurements. I have a 1.6 GHz CPU and want to take advantage of it. I
think it should be able to recognize Ada identifiers as a type them.

The regexp guru that I once talked with suggested this:
[[:alpha:]](?:_?[^\W_])*

The (?:) is equivalent to () but faster since it is a so-called
non-capturing group, which should always be used when capturing is not
needed. Maybe that helps?

>> There seems to be a lot of places with a-z in ada-mode.el.
>>     
>
> Yes. I suppose Stephen will welcome patches, assuming they are correct.
>
> Are you aware of the Emacs ada-mode hompage
>
>   http://www.stephe-leake.org/emacs/ada-mode/emacs-ada-mode.html
>
> and list
>
>   http://stephe-leake.org/mailman/listinfo/emacs-ada-mode_stephe-leake.org
>
> ?
>   

No, I just subscribed now, thanks. If I make any changes I will send it
there.