Ludovic Brenta <[email protected]> writes:
> $ touch flightlist_display-menu_callbacks-select_npercent_dialog.ads
>
> In emacs, visit the new file.
>
> First of all, one word "header" appears in the file. I don't know
> what in emacs added this word.
It's from ada-skel.el; you can disable it by:
(setq ada-skel-initial-string nil)
later versions of Ada mode set it to "{header}", which is a
"placeholder". Placeholders are ignored by the parser (they have comment
syntax), and can be expanded by ada-skel.
> Now type:
>
> private package
> Flightlist_Display.Menu_Callbacks.Select_Npercent_Dialog is
>
> Before you type RET, do C-c C-f; the message minibuffer says "parse
> succeeded".
Because no parsing has been attempted yet; that's somewhat misleading.
> Now type RET
That parses in order to indent.
> then C-c C-f again. The minibuffer says:
>
> flightlist_display-menu_callbacks-select_npercent_dialog.ads:2:0: \
> syntax error in grammar state 161; unexpected , expecting one of \
> (default END PRIVATE USE SUBTYPE PRAGMA NOT OVERRIDING FUNCTION \
> PROCEDURE ENTRY FOR IDENTIFIER TYPE GENERIC PROTECTED TASK PACKAGE)
You must have wisi-debug set higher than 0 (the default); parse errors
are silent with wisi-debug = 0.
> (This error message is repeated two times and also appears in the
> *Messages* buffer. Did the parser find an unexpected whitespace
> character or an unexpected comma, which appears nowhere in the
> source?)
>
> The parsing continues to fail after that, so auto-indentation does
> not work at all on anything I type after the package name...
The parser requires a complete package:
package name
end package;
Parsing will fail until the "end package" is found.
In general, the parser always requires a complete declaration or
statement. The parser accepts a superset of the Ada syntax; lots of
things can be left out, but never "end".
This is discussed in ada-mode.info, section Indentation. Let me know how
that can be improved.
That's partly why I introduced ada-skel. you can type:
private package Flightlist_Display.Menu_Callbacks.Select_Npercent_Dialog
C-c C-e
and it will prompt you for "body | spec". Answer "spec", and it will
insert the rest of the package syntax for you, leaving :
private package Flightlist_Display.Menu_Callbacks.Select_Npercent_Dialog is
private
end Flightlist_Display.Menu_Callbacks.Select_Npercent_Dialog;
with point left before the second 'private'.
Now parsing succeeds. All skeletons provided with Ada mode are
guaranteed to pass parsing (although I don't have an automated test for
that). You have to guarantee that for skeletons you add.
> I don't know whether the parser will look at parent units when parsing
> a private child.
No, parsing is always within a single compilation unit.
--
-- Stephe
_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org