...
In fact, the code is general enough to be applied to every rule.
So it's pretty easy to make such changes with an ANTLR grammar for ANTLR grammars. This tool uses ANTLRv3.g to instrument the Java.g grammar in order to build parse trees. ANTLR has a built-in facility to to do thisbuild parse trees, but this tool demonstrates how to inject code into structured text files (another grammar in this case).
You should be able to run the file directly, or if not, save a copy of the tree.jar, then run
Code Block |
---|
java -jar tree.jar
|