How do I process or examine each token consumed by the parser?

Terence Parr

Override Parser.consume(). Put an class member action after the Parser class definition in your grammar file:

class P extends Parser;
  public void consume() throws IOException {
    //do what you want with LA(1)
    super.consume(); // MAKE SURE TO PUT THIS IN!!!
    //do what you want with LA(1)
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.