From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#56236: Package: emacs, ada-mode Date: Tue, 28 Jun 2022 15:24:03 +0200 Message-ID: <87letgq5u4.fsf@gnus.org> References: <302935684.2763160.1656258301795.ref@mail.yahoo.com> <302935684.2763160.1656258301795@mail.yahoo.com> <87ilonctee.fsf@gnus.org> <1632297600.4892837.1656259625032@mail.yahoo.com> <87edzbcsog.fsf@gnus.org> <2026151234.5124962.1656347169126@mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15586"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 56236@debbugs.gnu.org To: Cameron Howie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 28 15:35:31 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6BNK-0003ni-Sy for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Jun 2022 15:35:30 +0200 Original-Received: from localhost ([::1]:51242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6BNJ-0008TI-QJ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Jun 2022 09:35:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6BDD-0005ss-4p for bug-gnu-emacs@gnu.org; Tue, 28 Jun 2022 09:25:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o6BDC-0002Bp-Kq for bug-gnu-emacs@gnu.org; Tue, 28 Jun 2022 09:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o6BDC-0006DA-Hn for bug-gnu-emacs@gnu.org; Tue, 28 Jun 2022 09:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Jun 2022 13:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56236 X-GNU-PR-Package: emacs Original-Received: via spool by 56236-submit@debbugs.gnu.org id=B56236.165642266823827 (code B ref 56236); Tue, 28 Jun 2022 13:25:02 +0000 Original-Received: (at 56236) by debbugs.gnu.org; 28 Jun 2022 13:24:28 +0000 Original-Received: from localhost ([127.0.0.1]:54303 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6BCe-0006CF-2q for submit@debbugs.gnu.org; Tue, 28 Jun 2022 09:24:28 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:48522) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6BCc-0006C3-Mk for 56236@debbugs.gnu.org; Tue, 28 Jun 2022 09:24:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rRcvbkfyfLk9JMUGWyyFWAWNSzuRa/D2T3VFa3Lcygo=; b=Aos3RZavWEBeOK9Wiad4NX4Uz0 yFHe9P34rt3VoyKqYPz3uYkP+LmqQDsMGgc1i2n3TFBfaDv5VsNKkQfmwEhac3iSeRJLTxXLQmM4A 8SegfPfUhR3x8Eit3UH6dq+acd1ySMfFPXjjIyh297DKsTtHYiZ1w/WTu0DDtSiSlNuI=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6BCK-0002Sf-HC; Tue, 28 Jun 2022 15:24:10 +0200 X-Now-Playing: Hannah Diamond's _PC Music Volume 3_: "Staring At The Ceiling" In-Reply-To: <2026151234.5124962.1656347169126@mail.yahoo.com> (Cameron Howie's message of "Mon, 27 Jun 2022 16:26:09 +0000 (UTC)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:235542 Archived-At: (Forwarding to make it land in the bug tracker; resending didn't work, apparently.) Cameron Howie writes: > Hi Lars, > > Following up on the emails of yesterday, I have pasted below into this message a > concrete example Ada code that raises issues with the Ada Mode plug-in regarding > using of a "declaration expression" inside a Postcondition. As commented in the code > itself, if you remove the comment markers from the Postcondition the Ada Mode > parser indicates all sorts of errors when in fact the Postcondition is legal Ada 2022. > > I didn't want to send to the "56236@debbugs.gnu.org address as you may have some > better way of handling this internally... > > -------- EXAMPLE FILE main.adb STARTS HERE > > -- Build with e.g., "gnatmake main.adb -gnat2020" > -- EMACS ADA MODE ISSUE: remove the 'commented out' Postcondition for > -- Absolute_Difference and the Ada Mode parser signals > -- all sorts of errors. > > with Ada.Text_IO; use Ada.Text_IO; > > procedure Main > is > procedure Absolute_Difference > (x, y : Integer; > diff : out Integer) > -- with Post => (declare > -- min : constant Integer := Integer'Min(x, y); > -- max : constant Integer := Integer'Max(x, y); > -- begin diff = max - min) > is > begin > diff := abs x - y; > end Absolute_Difference; > > u : constant Integer := 95; > v : constant Integer := 5; > d : Integer; > begin > Absolute_Difference (u, v, diff => d); > Put_Line ("Absolute difference =" & d'Img); -- prints "90" > end Main; > > -------- END OF EXAMPLE FILE main.adb > > On Sunday, June 26, 2022, 06:09:57 PM GMT+2, Lars Ingebrigtsen > wrote: > > (Resending with the debbugs address in the CC header so that it lands in > the bug tracker.) > > Cameron Howie writes: > >> No immediately, Lars, no. However, I can send one through tomorrow. Off the top > of >> my head, the issue arises when I use a declare expression in a Post condition, so >> something like this: >> >> procedure Foo >> (x, y : Integer; >> arr : in out Integer_Array) >> with Post => (declare sum : constant Integer := Sum_Elements (arr); begin sum >= > x >> + y); >> >> I've not yet used the declare expression syntax in a subprogram body, just (so far) > in >> contract specifications. >> >> On Sunday, June 26, 2022, 05:54:21 PM GMT+2, Lars Ingebrigtsen > >> wrote: >> >> Cameron Howie via "Bug reports for GNU Emacs, the Swiss army knife of >> >> text editors" writes: >> >>> I'm using Ada Mode version 7.2.0. The internal parser is currently >>> failing to handle Ada 2022 "declare expression" syntax. This leads to >>> other problems like various parsing-sensitive commands failing. My >>> only (current) solution is to use older Ada syntax. >> >> Do you have a code snippet that demonstrates these problems? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no