ada-mode-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ada-mode-users] Indentation of arrows in associations


From: Stephen Leake
Subject: Re: [Ada-mode-users] Indentation of arrows in associations
Date: Thu, 29 Sep 2016 10:14:49 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

Ludovic Brenta <address@hidden> writes:

>         Record_History (Flights (Count),
>                         RTFM_Recreated_And_Flight_Status_Updated
>                                          =>
> Normal_Flight_RTFM_Recreated_And_Flight_Status_Updated and then Count
> = Count_Option.Normal,
>                         EFD_Logged_In_Oplog => EFD_Logged_In_Oplog);
>
>
> and even more obvious at another place:
>
>             M_CDM.Process_CASA_Reply (Flights,
>                                       The_New_CASA_Result       =>
> (FTFX.Main_CASA_Result, FTFX.Detailed_CASA_Result),
>                                       Old_Detailed_CASA_Result
>                                                                               
>                                       =>
> Flights (Count_Option.Proposal).Fixed_Info.Detailed_CASA_Result,
>                                       Measures_Related_CDM_Data =>
> FTFX.Measures_Related_CDM_Data);
>
>
> It looks like ada-wisi indents arrows relative to the comma two
> lines above.   

Actually, it indents to the previous comma; more precisely, the
"containing" cache set by the grammar.

This was designed to handle case statements (from test/ada_mode-nominal.adb):

         case Local_4 is
            when
              A | -- continuation line; ada-indent-broken = 2
              B |
              C
              => -- Ada mode 4.01 indentation
               for I in 1 .. 10 loop
                  Local_1 := Local_1 + Local_1;

For association_lists, the grammar sets the wrong containing cache;
here's a patch:

#
# old_revision [d2c4f08999fae44acb5b01847d1080e727957d8e]
#
# patch "ada-grammar.wy"
#  from [f27a808070728ac9ec538e48a2b2c19212cce4ac]
#    to [ed44910c83b62e290b2e2b577017cfcfb8a5f430]
#
============================================================
--- ada-grammar.wy      f27a808070728ac9ec538e48a2b2c19212cce4ac
+++ ada-grammar.wy      ed44910c83b62e290b2e2b577017cfcfb8a5f430
@@ -438,8 +438,7 @@ association_list
   : association_opt
   | association_list COMMA association_opt
     (progn
-      (wisi-statement-action [2 list-break])
-      (wisi-containing-action 2 3))
+      (wisi-statement-action [2 list-break]))
   ;
 
 asynchronous_select
--------------

This passes all the indentation tests, so it was simply a mistake to
have that containing-action in the first place. The correct containing
cache (the open paren) is set by the higher-level grammar statements.

-- 
-- Stephe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]