Simon Wright <[email protected]> writes: > On 29 Nov 2015, at 17:22, Simon Wright <[email protected]> wrote: >> >> I've been having some trouble with aspects on complex declarations. >> >> Given this: >> >> package Imenu is >> ... >> type Date_Set is new Iterator_Interfaces.Forward_Iterator with private >> with >> Constant_Indexing => Element, >> Default_Iterator => Iterate, >> Iterator_Element => Ada.Calendar.Time; >> end Imenu; >> >> C-c C-f fails with point after the 'd' of 'end', and >> >> imenu.ada:83:3: wisi-containing-action: containing-token 'is' has no cache. >> grammar error; missing action >> >> I wondered whether this was caused by the unusual set of >> 'wisi-containing-action's in >> >> private_extension_declaration >> : TYPE IDENTIFIER discriminant_part_opt IS >> abstract_limited_synchronized_opt NEW subtype_indication >> and_interface_list_opt WITH PRIVATE aspect_specification_opt SEMICOLON >> (progn >> (wisi-statement-action [1 statement-start 2 name 6 statement-other 12 >> statement-end]) >> (wisi-containing-action 1 3) >> (wisi-containing-action 6 7) >> (wisi-containing-action 6 8) >> (wisi-containing-action 4 11) >> (wisi-face-action [2 font-lock-type-face])) >> ;
Yes, this is the problem. > I changed ada-grammar.wy as > > @@ -1787,7 +1789,7 @@ > (wisi-containing-action 1 3) > (wisi-containing-action 6 7) > (wisi-containing-action 6 8) > - (wisi-containing-action 4 11) > + (wisi-containing-action 1 11) > (wisi-face-action [2 font-lock-type-face])) > ; > > and now I don't get a problem. (is this caused because token 4, the >'is', isn't referenced in 'wisi-statement-action'? Yes. Congratulations; you are promoted to the rank of grammar adventurer :). > if so, should it be, Not in this case, > & if so, how?) See wisi-statement-action in full_type_declaration for a good example; the "IS" is given class "statement-other", and it contains the type_definition and the aspect_specification_opt. In private_extension_declaration, "NEW" is 6th token, has class statement-other, and contains 7 subtype_indication and 8 and_interface_list_opt. It should also contain 11 aspect_specification_opt; the bug is that '4' should be '6' (copied and not edited fully). Note that only keywords (all caps) need to be mentioned in wisi-statement-action; grammar symbols get classes in their definitions. > This gives me > > type T is new B with private > with > Aspect1, > Aspect2; > > procedure P > with Aspect; > > and I'd quite like to align T's aspect_specification with 'type', like >P's (or vice versa; consistently, anyway). This is tested in test/aspects.ads. I've added your private extension example to that. -- -- Stephe _______________________________________________ Emacs-ada-mode mailing list [email protected] http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org
