unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#56236: Package: emacs, ada-mode
       [not found] <302935684.2763160.1656258301795.ref@mail.yahoo.com>
@ 2022-06-26 15:45 ` Cameron Howie via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-26 15:54   ` Lars Ingebrigtsen
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Cameron Howie via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-06-26 15:45 UTC (permalink / raw)
  To: 56236

[-- Attachment #1: Type: text/plain, Size: 290 bytes --]

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. 
Many thanks for this plug-in :)

[-- Attachment #2: Type: text/html, Size: 575 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#56236: Package: emacs, ada-mode
  2022-06-26 15:45 ` bug#56236: Package: emacs, ada-mode Cameron Howie via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-06-26 15:54   ` Lars Ingebrigtsen
       [not found]     ` <1632297600.4892837.1656259625032@mail.yahoo.com>
  2022-10-10 21:07   ` bug#56236: handle "declare expression" Stephen Leake
  2023-01-25 14:03   ` bug#56236: Package: emacs, ada-mode Stephen Leake
  2 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-26 15:54 UTC (permalink / raw)
  To: 56236; +Cc: Cameron Howie

Cameron Howie via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> 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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#56236: Package: emacs, ada-mode
       [not found]     ` <1632297600.4892837.1656259625032@mail.yahoo.com>
@ 2022-06-26 16:09       ` Lars Ingebrigtsen
  2022-06-27 16:26         ` Cameron Howie
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-26 16:09 UTC (permalink / raw)
  To: Cameron Howie; +Cc: 56236

(Resending with the debbugs address in the CC header so that it lands in
the bug tracker.)

Cameron Howie <howiect@yahoo.com> 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 <larsi@gnus.org>
> wrote: 
>
> Cameron Howie via "Bug reports for GNU Emacs, the Swiss army knife of
>
> text editors" <bug-gnu-emacs@gnu.org> 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?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#56236: Package: emacs, ada-mode
  2022-06-26 16:09       ` Lars Ingebrigtsen
@ 2022-06-27 16:26         ` Cameron Howie
  2022-06-28 11:27           ` Lars Ingebrigtsen
  2022-06-28 13:24           ` Lars Ingebrigtsen
  0 siblings, 2 replies; 10+ messages in thread
From: Cameron Howie @ 2022-06-27 16:26 UTC (permalink / raw)
  To: Lars Ingebrigtsen

[-- Attachment #1: Type: text/plain, Size: 2841 bytes --]

 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 Mainis   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 <larsi@gnus.org> wrote:  
 
 (Resending with the debbugs address in the CC header so that it lands in
the bug tracker.)

Cameron Howie <howiect@yahoo.com> 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 <larsi@gnus.org>
> wrote: 
>
> Cameron Howie via "Bug reports for GNU Emacs, the Swiss army knife of
>
> text editors" <bug-gnu-emacs@gnu.org> 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?
  

[-- Attachment #2: Type: text/html, Size: 5589 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#56236: Package: emacs, ada-mode
  2022-06-27 16:26         ` Cameron Howie
@ 2022-06-28 11:27           ` Lars Ingebrigtsen
  2022-06-28 13:24           ` Lars Ingebrigtsen
  1 sibling, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-28 11:27 UTC (permalink / raw)
  To: Cameron Howie; +Cc: 56236

Cameron Howie <howiect@yahoo.com> writes:

> I didn't want to send to the "56236@debbugs.gnu.org address as you may
> have some better way of handling this internally...

I've now resent your mail to 56236@debbugs.gnu.org.  Including that in
the CCs is the way debbugs works.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#56236: Package: emacs, ada-mode
  2022-06-27 16:26         ` Cameron Howie
  2022-06-28 11:27           ` Lars Ingebrigtsen
@ 2022-06-28 13:24           ` Lars Ingebrigtsen
  2022-06-28 13:50             ` Lars Ingebrigtsen
  2022-06-28 23:55             ` Stephen Leake
  1 sibling, 2 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-28 13:24 UTC (permalink / raw)
  To: Cameron Howie; +Cc: 56236

(Forwarding to make it land in the bug tracker; resending didn't work,
apparently.)

Cameron Howie <howiect@yahoo.com> 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 <larsi@gnus.org>
> wrote: 
>
> (Resending with the debbugs address in the CC header so that it lands in
> the bug tracker.)
>
> Cameron Howie <howiect@yahoo.com> 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
> <larsi@gnus.org>
>> wrote: 
>>
>> Cameron Howie via "Bug reports for GNU Emacs, the Swiss army knife of
>>
>> text editors" <bug-gnu-emacs@gnu.org> 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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#56236: Package: emacs, ada-mode
  2022-06-28 13:24           ` Lars Ingebrigtsen
@ 2022-06-28 13:50             ` Lars Ingebrigtsen
  2022-06-28 23:55             ` Stephen Leake
  1 sibling, 0 replies; 10+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-28 13:50 UTC (permalink / raw)
  To: Cameron Howie; +Cc: 56236, Stephen Leake

Lars Ingebrigtsen <larsi@gnus.org> writes:

>> 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've added Stephen to the CCs; perhaps he has some comments.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#56236: Package: emacs, ada-mode
  2022-06-28 13:24           ` Lars Ingebrigtsen
  2022-06-28 13:50             ` Lars Ingebrigtsen
@ 2022-06-28 23:55             ` Stephen Leake
  1 sibling, 0 replies; 10+ messages in thread
From: Stephen Leake @ 2022-06-28 23:55 UTC (permalink / raw)
  To: 56236

The development verison of ada-mode parses this, and indents it nicely:

   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;

Time for a new release.

-- 
-- Stephe





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#56236: handle "declare expression"
  2022-06-26 15:45 ` bug#56236: Package: emacs, ada-mode Cameron Howie via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-26 15:54   ` Lars Ingebrigtsen
@ 2022-10-10 21:07   ` Stephen Leake
  2023-01-25 14:03   ` bug#56236: Package: emacs, ada-mode Stephen Leake
  2 siblings, 0 replies; 10+ messages in thread
From: Stephen Leake @ 2022-10-10 21:07 UTC (permalink / raw)
  To: 56236

Note that the devel version can now be accessed via the devel ELPA
package:

M-; (add-to-list 'package-archives (cons "gnu-devel" "https://elpa.gnu.org/devel"))

M-x list-packages

install ada-mode 7.3.beta

-- 
-- Stephe





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#56236: Package: emacs, ada-mode
  2022-06-26 15:45 ` bug#56236: Package: emacs, ada-mode Cameron Howie via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-06-26 15:54   ` Lars Ingebrigtsen
  2022-10-10 21:07   ` bug#56236: handle "declare expression" Stephen Leake
@ 2023-01-25 14:03   ` Stephen Leake
  2 siblings, 0 replies; 10+ messages in thread
From: Stephen Leake @ 2023-01-25 14:03 UTC (permalink / raw)
  To: 56236-close

closed by ada-mode version 8.0.4
-- 
-- Stephe





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-01-25 14:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <302935684.2763160.1656258301795.ref@mail.yahoo.com>
2022-06-26 15:45 ` bug#56236: Package: emacs, ada-mode Cameron Howie via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-26 15:54   ` Lars Ingebrigtsen
     [not found]     ` <1632297600.4892837.1656259625032@mail.yahoo.com>
2022-06-26 16:09       ` Lars Ingebrigtsen
2022-06-27 16:26         ` Cameron Howie
2022-06-28 11:27           ` Lars Ingebrigtsen
2022-06-28 13:24           ` Lars Ingebrigtsen
2022-06-28 13:50             ` Lars Ingebrigtsen
2022-06-28 23:55             ` Stephen Leake
2022-10-10 21:07   ` bug#56236: handle "declare expression" Stephen Leake
2023-01-25 14:03   ` bug#56236: Package: emacs, ada-mode Stephen Leake

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).