Am 05.03.2015 um 17:42 schrieb Stephen Leake <[email protected]>:
> 
> It turns out that _no_ Ada compilation unit can be divided, at least if
> we keep all of the current indentation rules. That's why the simpler
> parser supported by SMIE was not successful for ada-mode.

How tricky would it be to inject "virtual package bodies"?
E.g., as outlined below, I imagine one could treat all text
in there like a parsing unit. Maybe even "outsource" it to
a temporary buffer, and then simply adjust for current ada-indent.

The markers would be understood to be bracketing, that is, either
come in pairs or be self-fertile as needed by the Wisi parser.
Emacs page delimiters being regular expressions, they could
also cover both opening and closing marks.


> Since GNAT requires one compilation unit per file, there is nothing to
> be gained by this approach.
> 

Just for completeness, I think that there are multi-unit
files in the GNAT world, since gcc understands -gnateInnn
for picking a unit from a file.


The outline of virtual package bodies mentioned above has
markers for where a virtual package body would be inserted,
The parser would choose some temporary names. This is shown
in expanded form further below.

package body P is
   
   procedure P1
   is begin
      null;
   end P1;
   
--8<--  
   
   procedure P2
   is begin
      null;
   end P2;
   
   procedure P3
   is begin
      null;
   end P3;
   
-->8--     
   
begin
   null;
end P;


package body P is

   procedure P1
   is begin
      null;
   end P1;

   package body Parsing_Unit_1 is

      procedure P2
      is begin
         null;
      end P2;
      
      procedure P3
      is begin
         null;
      end P3;
      
   end Parsing_Unit_1;

begin
   null;
end P;

> 
>  Computing the shortest completion
> from any state is possible at grammar generation time; I have not seen
> an algorithm for that, but it seems straightforward.

Chances are they are mentioned in Grune & Jacobs,
the first edition is available online:
http://dickgrune.com/Books/PTAPG_1st_Edition/


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

Reply via email to