Simon Wright <[email protected]> writes:

> It looks to me as though the problem is that the ‘with’ needed to be
> marked in some way.

Yes.

> I fumbled this patch
>
> --- a/ada-grammar.wy  Sat Mar 28 17:46:32 2015 +0000
> +++ b/ada-grammar.wy  Mon Mar 30 21:13:45 2015 +0100
> @@ -1918,7 +1918,7 @@
>    : PROTECTED TYPE IDENTIFIER discriminant_part_opt aspect_specification_opt 
> IS NEW interface_list WITH
>      protected_definition SEMICOLON
>      (progn
> -      (wisi-statement-action [1 statement-start 3 name 6 block-start 11 
> statement-end])
> +      (wisi-statement-action [1 statement-start 3 name 6 block-start 9 
> statement-other 11 statement-end])
>        (wisi-containing-action 1 3)
>        (wisi-containing-action 3 5)
>        (wisi-containing-action 9 10)
>
> without knowing what I was doing;

The numbers are the cardinal position of the tokens; "WITH" is token 9.
However, "SEMICOLON" (token 11) must be marked with "statement end", so
the right patch is below

>it’s getting somewhere, because indenting the whole file “succeeds”
>resulting in
>
> package Protected_Type is
>
>    protected type EXTI_Handler
>    is new EXTI_IRQ_Handler with
> overriding
> entry Button_Pressed (B : out Interfaces.Unsigned_32);
>    private
>       Triggered       : Boolean := False;
>       Last_Read_Value : Interfaces.Unsigned_32;
>       procedure Handler;
>       pragma Attach_Handler (Handler, Interrupt_Name);
>    end EXTI_Handler;
>
>    EXTI15_10_IRQ : aliased EXTI_Handler
>      (Interrupt_Name => Ada.Interrupts.Names.EXTI15_10_IRQ);
>
> end Protected_Type;
>

This is because there's a missing case in ada-wisi.el
ada-wisi-after-cache (which also means there's a cl-case that should be
cl-ecase).

However, the best fix is to change the container structure above:
'protected_definition' should be contained by "IS", because it is a
block-start.

Here's the patch:

============================================================
--- ada-grammar.wy      ac6dd7f7e1cb647a5f032b51db4dfa366bdf2108
+++ ada-grammar.wy      8e531a20b5892b0289d7d4309358c6ac0b634762

@@ -1918,10 +1915,10 @@ protected_type_declaration
   : PROTECTED TYPE IDENTIFIER discriminant_part_opt aspect_specification_opt 
IS NEW interface_list WITH
     protected_definition SEMICOLON
     (progn
-      (wisi-statement-action [1 statement-start 3 name 6 block-start 11 
statement-end])
+      (wisi-statement-action [1 statement-start 3 name 6 block-start 9 
statement-other 11 statement-end])
       (wisi-containing-action 1 3)
       (wisi-containing-action 3 5)
-      (wisi-containing-action 9 10)
+      (wisi-containing-action 6 10)
       (wisi-face-action [3 font-lock-type-face]))
   | PROTECTED TYPE IDENTIFIER discriminant_part_opt aspect_specification_opt 
IS protected_definition SEMICOLON
     (progn

--
-- Stephe

_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to