Sven Van Echelpoel wrote: > Hi, > > I have observed that the pairing of @init/@after seems to be lost once > backtracking is introduced, at least in a tree grammar. Most of my rules > look like this: > > some_rule > @init { enterParserRule( SomeRule ); } > @after { leaveParserRule( SomeRule ); } > @after is not supported in the C target. While it can be hacked in, there are ramification for all the combinations of backtracking, predicates, exceptions and so on. I do intend to give this a thorough going over before the next release though.
You can generally do what you need though like this: s : {start();} ( alt1 | alt2 | alt3) { end(); } ; I also recommend that you do not use backtracking for a production parser. > Would it be correct to say that during backtracking the 'stack' is not > properly unwound, Sort of ;-) It is complicated to get all of this to work exactly like try {} catch {} finally {}. I think I can probably do it, but it needs some effort in the templates. I'll 'rule' on this for the next release. Jim List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-interest@googlegroups.com To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---