GNU bug report logs - #1913
Identifier after reserved word "raise" is not always highlighted in Ada-mode

Previous Next

Package: emacs;

Reported by: Erik <esigra <at> gmail.com>

Date: Thu, 15 Jan 2009 08:05:05 UTC

Severity: minor

Done: Stephen Leake <stephen_leake <at> stephe-leake.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Erik <esigra <at> gmail.com>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 1913 <at> debbugs.gnu.org
Subject: bug#1913: Identifier after reserved word "raise" is not always highlighted in Ada-mode
Date: Thu, 15 Jan 2009 14:40:54 +0100
Juanma Barranquero skrev:
> On Thu, Jan 15, 2009 at 08:59, Erik <esigra <at> gmail.com> wrote:
>   
>> So how should I tell the highlighter that the file is
>> Ada95 or Ada2005 (and not Ada83)? I think that emacs should assume that
>> the file is not Ada83 if a non-ASCII character is used in an identifier.
>>     
>
> It's not that the Ada mode is assuming any specific version. There's a
> variable `ada-language-version', but it just affects which keywords
> are recognized as such. The problem is simply that some of the regexps
> were written in the ASCII-only era and have not been updated.
>
> Try the following patch, which should fix this particular case. I'll
> bring the issue to the Ada mode maintainer for a more permanent fix.
>
>     Juanma
>
>
> Index: lisp/progmodes/ada-mode.el
> ===================================================================
> RCS file: /sources/emacs/emacs/lisp/progmodes/ada-mode.el,v
> retrieving revision 1.101
> diff -u -2 -r1.101 ada-mode.el
> --- lisp/progmodes/ada-mode.el	9 Jan 2009 04:15:56 -0000	1.101
> +++ lisp/progmodes/ada-mode.el	15 Jan 2009 09:05:02 -0000
> @@ -5224,5 +5224,5 @@
>       ;; correctly highlight a with_clause that spans multiple lines.
>       (list (concat "\\<\\(goto\\|raise\\|use\\|with\\)"
> -		   "[ \t]+\\([a-zA-Z0-9_., \t]+\\)\\W")
> +		   "[ \t]+\\([[:alnum:]_., \t]+\\)\\W")
>  	   '(1 font-lock-keyword-face) '(2 font-lock-reference-face nil t))
>   

The patch is an improvement, but it highlights some illegal identifiers.
The correct regexp for an Ada identifier is "[[:alpha:]](_?[^\W_])*".
See this example (in bash):
for i in hög _hög h_ög h__ög h_ö_g hög_ _ hau_og do
    echo $i | egrep "^[[:alpha:]](_?[^\W_])*$"
done


It only matches the allowed identifiers:
hög
h_ög
h_ö_g
hau_og

(no leading, consecutive or trailing '_')

There seems to be a lot of places with a-z in ada-mode.el.




This bug report was last modified 4 years and 329 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.