Georg Bauhaus <[email protected]> writes: > 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"?
Error recovery would add tokens to complete the current grammar sentence; that's the same as the "end virtual package body". Your proposal adds additional start points, with the help of the user. That would save time. A similar way to save time without requireing user intervention is to cache parse results at various points in the file, and restart parsing from there when needed. >> 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. ada-mode does in fact support multiple compilation units per file. However, it still always starts parsing from the beginning of the file, since that is the only reliable way to find the end of each compilation unit. We could optimize that; if the first compilation unit is not modified, we could use the parsed in formation to find the end of it, and start parsing from there. I'm not going to add that unless someone specifically requests it. >> 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/ I have that pdf; it's not in there. It might be in the second edition. -- -- Stephe _______________________________________________ Emacs-ada-mode mailing list [email protected] http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org
