当前位置: 动力学知识库 > 问答 > 编程问答 >

ANTLR4. How to detect ParseTree node type?

问题描述:

I was able to get an object of class org.antlr.v4.runtime.tree.ParseTree from my Parser class. Now I'd like to visit every node and generate custom output based on the tree node type. How is it could be done in ANTLR4? There are no methods like getTreeNodeType().

网友答案:

Java provides a getClass() method you can use. Beyond that you'll need to be more specific about what information you need.

分享给朋友:
您可能感兴趣的文章:
随机阅读: