Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

[in progressSee tree-patterns branch in parrt/antlr4]

ANTLR 4 introduced a visitor and listener mechanism that lets you implement DOM visiting or SAX-analogous event processing of tree nodes. This works great. For example, if all you care about our looking at Java method declarations, grab the Java.g4 file and then override methodDeclaration in JavaBaseListener. From there, a ParseTreeWalker can trigger calls to your overridden method for you as it walks the tree. Easy things are easy.

...