1

I am writing a program that utilizes an javaparser generated by antlr4 (4.7). In this programm i need to change the TreeAdaptor the parser is using. Everything i found in the internet tells me to use the setTreeAdaptor() function of the parser but this method doesn't exist.

Do I have to manually write this method? Do I have to configure the Antlr plugin to genereate this method within the parser or has the method been replaced?

  • `TreeAdaptor` is an ANTLR3 class, no longer available in v4. In v4, there is less support to mutate the parse tree: this is what listeners and visitors in v4 are for: you take the (more or less immutable) parse tree, and traverse it yourself and build your own tree structure (using plain classes/functionality of the target language you're using). – Bart Kiers Jan 28 '22 at 10:51
  • 1
    No problem. You could edit your question and ask something about the actual problem you're trying to solve: perhaps someone can help with that. – Bart Kiers Jan 28 '22 at 12:17

0 Answers0