From: Erik <esigra@gmail.com>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: 1913@emacsbugs.donarmstrong.com
Subject: bug#1913: Identifier after reserved word "raise" is not always highlighted in Ada-mode
Date: Thu, 15 Jan 2009 14:40:54 +0100 [thread overview]
Message-ID: <496F3CE6.3080600@gmail.com> (raw)
In-Reply-To: <f7ccd24b0901150112w2ae0751n677207db473585e3@mail.gmail.com>
Juanma Barranquero skrev:
> On Thu, Jan 15, 2009 at 08:59, Erik <esigra@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.
next prev parent reply other threads:[~2009-01-15 13:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-15 7:59 bug#1913: Identifier after reserved word "raise" is not always highlighted in Ada-mode Erik
2009-01-15 9:12 ` Juanma Barranquero
2009-01-15 13:40 ` Erik [this message]
2009-01-15 14:42 ` Juanma Barranquero
2009-01-15 23:03 ` Erik
2009-01-15 23:10 ` Juanma Barranquero
2009-01-16 2:16 ` Stefan Monnier
2009-01-16 2:22 ` Juanma Barranquero
2020-04-16 18:42 ` Stephen Leake
2020-07-02 18:11 ` bug#1913: closed by ada-mode version 7.1 Stephen Leake
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=496F3CE6.3080600@gmail.com \
--to=esigra@gmail.com \
--cc=1913@emacsbugs.donarmstrong.com \
--cc=lekktu@gmail.com \
/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.