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 ); } : // the actual rule ; I have one ordinary grammar and a bunch of tree grammars in a pipeline. The grammars in the front of the pipeline have some rules that either have automatic backtracking switched on, or have some syntactic predicates. The grammars at the end of the pipeline do not require this. Now, I have observed that those grammars in which I have introduced backtracking the symmetric pairing of @init/@after is lost. I.E. I get much more enterParserRule() calls then leaveParserRule(). Because the code behind it relies on this symmetry, I find myself in somewhat of a pickle. Note that I'm not using scopes in these instances, as I want to keep the actual implementation of the parser neatly separated from the generated parser. I only use scopes to communicate values up the stack during parsing. Would it be correct to say that during backtracking the 'stack' is not properly unwound, or am I missing something obvious? I'm not saying that this is a bug or that there may not be very good reasons for this behavior. I'm just trying to understand what I'm observing, so that I can properly deal with this. Any input would be greatly appreciated. Thanks, Sven 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 -~----------~----~----~----~------~----~------~--~---