setting setBuildParseTree to false means that your walker will have nothing to walk. [1]简单来说BuildParseTree=false与Listener模式不兼容。

Look for grammar actions

如果用Mike Lischke的方法,parser还是要去分析那些不感兴趣的文本。正如其它人提到的“discarding these code blocks during lexing might be easier. Discarding them in the parser would mean that everything inside the { … } will still need to be tokenized.”


  1. GRosenberg. Are there any good examples to references where setBuildParseTree = false?. . 2016-04-13 [2019-04-28].