From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Ada reference manual rule for doubled parentheses around if_expression? Date: Sat, 01 Aug 2015 08:36:35 +0100 Organization: A noiseless patient Spider Message-ID: References: <864mkkz2hy.fsf@stephe-leake.org> <87r3nokwpf.fsf@theworld.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="fbe1d5b0173017f7cc2ccfa8ad3bc8c1"; logging-data="13351"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+sKdHvvlLlUCp0VrhRUBb5ixgt4CkyD4M=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:5g9WYwVDgZ8lk2BIMxI3/QKQIHk= sha1:kKJi2AExpl9r4gt12YdiY32m6xg= Xref: news.eternal-september.org comp.lang.ada:27286 Date: 2015-08-01T08:36:35+01:00 List-Id: Bob Duff writes: > Stephen Leake writes: > >> A question recently came up on the Emacs ada-mode list; my Emacs >> ada-mode parser rejects this if_expression in an association list: >> >> Tmp : Boolean := Id (if True then True else True); >> >> but accepts this: >> >> Tmp : Boolean := Id ((if True then True else True)); >> >> I remember seeing some rule in the Ada reference manual that says the >> doubled parens are not needed here. But now I can't find the rule, >> and I don't want to edit my grammar without a reference. >> >> Anyone know where that rule is? or what to search for? > > 4.5.7(7). This is a syntax rule, despite not being written in BNF. I > suggest you read the AARM annotations. The question to which Stephe refers also shows function F2 (V : Integer) return Boolean is (True and then True) or else True; which GNAT accepts but probably shouldn't? the parens in ARM 6.8(2)[1] wrap the whole expression. [1] http://www.ada-auth.org/standards/12rm/html/RM-6-8.html#p2