'antlr 4.10.1 for JavaScript doesn't seem to have a buildParseTrees property
I'm using MacOS with antlr installed with brew to generate a parser for Creole in JavaScript. It appears to correctly generate all the files but there is no sign of the buildParseTrees property... most examples look something like this:
const lexer = new CreoleLexer(input)
const tokens = new antlr4.CommonTokenStream(lexer);
const parser = new CreoleParser(tokens);
parser.buildParseTrees = true;
const tree = parser.document();
but buildParseTrees is not a property generated on my parser. Both the generator and the JavaScript runtime are using 4.10.1. Has the documentation not been updated or am I missing something (an option)?
Solution 1:[1]
The buildParseTrees property is defined in the base Parser.js class which your generated parser extends. But true is the default value, so you can just remove the line parser.buildParseTrees = true;.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Bart Kiers |
