Folks, I have been struggling with trying to get a list of next possible tokens for a bit now and may use some help. A page here http://www.antlr.org/wiki/pages/viewpage.action?pageId=11567208 talks about how to retrieve a list of possible options but it doesnt seem to cover all bases so to speak. According to my observations ANTLR has two places where next tokens can be obtained (Match function whose parameter indicates next options and PushFollow that preceeds rule invocation and places possibilities in a state follow stack). Also a rule may have optional token (TOKEN1 TOKEN2* for example) in which case TOKEN2 may or may not be present but no mismatch errors are triggered. ANTLR however knows that TOKEN2 may be expected. Another case is when predicates are used in a rule. Only 1 alternative is possible given rule semantics but all possible rule starts are reported as expected tokens in push follow stack. So what is the best strategy to get a list of next expected tokens that is a/ generic (so I dont have to weave code all over parser to make it happen) and b/ reliable (gives me next expected possible tokens only) Rgds. !!!
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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
