How to get a list of all valid options for the next token?(ANTLR 3)
get the list of FOLLOW sets for each rule, all you need is to access the FOLLOW stack with: BitSet fset = state.followingstate.fsp; ANTLR pushes the current set of tokens that can follow a particular invocation of the rule before it enters the rule. The Rule catches ... Other labels:
faq_errors, faq_analysis
Why doesn't my header show up in the lexer as well as the parser?(ANTLR 3)
Actions are specific to one grammar. When using a combined parser/lexer grammar, use // applies only to the parser: @header // applies only to the lexer: @lexer::header not just the @header. When using a separate (noncombined) parser, @header applies to the parser ...
Action execution during backtracking(ANTLR 3)
ANTLR must parse ahead to see if something matches. If it fails, then ANTLR tries the next viable alt. Upon failure, it's pretty hard to undo actions in general so ANTLR gates actions out with something like this: if ( backtracking==0 ) Labels ...