Remove setting buildParseTree=true because it's default value

Clarify doc and runtime test templates

fixes #4195

Signed-off-by: Ivan Kochurkin <kvanttt@gmail.com>
This commit is contained in:
Ivan Kochurkin 2023-06-01 16:04:57 +02:00 committed by Terence Parr
parent e85d3e28b8
commit 69bcc2172a
13 changed files with 1 additions and 15 deletions

View File

@ -40,7 +40,6 @@ public void MyParseMethod() {
ITokenSource lexer = new MyGrammarLexer(stream);
ITokenStream tokens = new CommonTokenStream(lexer);
MyGrammarParser parser = new MyGrammarParser(tokens);
parser.BuildParseTree = true;
IParseTree tree = parser.StartRule();
}
```

View File

@ -89,7 +89,6 @@ void main(List<String> args) async {
final tokens = CommonTokenStream(lexer);
final parser = JSONParser(tokens);
parser.addErrorListener(DiagnosticErrorListener());
parser.buildParseTree = true;
final tree = parser.json();
ParseTreeWalker.DEFAULT.walk(TreeShapeListener(), tree);
}

View File

@ -258,7 +258,6 @@ func main() {
stream := antlr.NewCommonTokenStream(lexer,0)
p := parser.NewJSONParser(stream)
p.AddErrorListener(antlr.NewDiagnosticErrorListener(true))
p.BuildParseTrees = true
tree := p.Json()
antlr.ParseTreeWalkerDefault.Walk(NewTreeShapeListener(), tree)
}

View File

@ -100,7 +100,6 @@ const chars = new antlr4.InputStream(input);
const lexer = new MyGrammarLexer(chars);
const tokens = new antlr4.CommonTokenStream(lexer);
const parser = new MyGrammarParser(tokens);
parser.buildParseTrees = true;
const tree = parser.MyStartRule();
```
@ -132,7 +131,6 @@ const chars = new antlr4.InputStream(input);
const lexer = new MyGrammarLexer(chars);
const tokens = new antlr4.CommonTokenStream(lexer);
const parser = new MyGrammarParser(tokens);
parser.buildParseTrees = true;
const tree = parser.MyQuery();
class Visitor {

View File

@ -84,7 +84,6 @@ $lexer = new JSONLexer($input);
$tokens = new CommonTokenStream($lexer);
$parser = new JSONParser($tokens);
$parser->addErrorListener(new DiagnosticErrorListener());
$parser->setBuildParseTree(true);
$tree = $parser->json();
ParseTreeWalker::default()->walk(new TreeShapeListener(), $tree);

View File

@ -17,9 +17,8 @@ public class Test {
parser.AddErrorListener(new DiagnosticErrorListener());
<endif>
<if(traceATN)>
ParserATNSimulator.trace_atn_sim = true;
ParserATNSimulator.trace_atn_sim = true;
<endif>
parser.BuildParseTree = true;
var tree = parser.<parserStartRuleName>();
ParseTreeWalker.Default.Walk(new TreeShapeListener(), tree);
<else>

View File

@ -19,7 +19,6 @@ void main(List\<String> args) async {
ProfilingATNSimulator profiler = ProfilingATNSimulator(parser);
parser.setInterpreter(profiler);
<endif>
parser.buildParseTree = true;
<if(profile)>
ProfilingATNSimulator profiler = ProfilingATNSimulator(parser);
parser.setInterpreter(profiler);

View File

@ -51,7 +51,6 @@ func main() {
<if(showDiagnosticErrors)>
p.AddErrorListener(antlr.NewDiagnosticErrorListener(true))
<endif>
p.BuildParseTrees = true
tree := p.<parserStartRuleName>()
antlr.ParseTreeWalkerDefault.Walk(NewTreeShapeListener(), tree)
<else>

View File

@ -31,7 +31,6 @@ function main(argv) {
<if(showDiagnosticErrors)>
parser.addErrorListener(new antlr4.error.DiagnosticErrorListener());
<endif>
parser.buildParseTrees = true;
const printer = function() {
this.println = function(s) { console.log(s); }
this.print = function(s) { process.stdout.write(s); }

View File

@ -58,7 +58,6 @@ $parser->addErrorListener(new ConsoleErrorListener());
<if(traceATN)>
ParserATNSimulator::$traceAtnSimulation = true;
<endif>
$parser->setBuildParseTree(true);
$tree = $parser-><parserStartRuleName>();
ParseTreeWalker::default()->walk(new TreeShapeListener(), $tree);

View File

@ -39,7 +39,6 @@ def main(argv):
<if(showDiagnosticErrors)>
parser.addErrorListener(DiagnosticErrorListener())
<endif>
parser.buildParseTrees = True
tree = parser.<parserStartRuleName>()
ParseTreeWalker.DEFAULT.walk(TreeShapeListener(), tree)
<else>

View File

@ -41,7 +41,6 @@ function main(argv: string[]): void {
<if(showDiagnosticErrors)>
parser.addErrorListener(new DiagnosticErrorListener());
<endif>
parser.buildParseTrees = true;
parser.printer = {
println : function(s: string) { console.log(s); },
print : function(s: string) { process.stdout.write(s); }

View File

@ -26,7 +26,6 @@ let parser = try <parserName>(tokens)
<if(showDiagnosticErrors)>
parser.addErrorListener(DiagnosticErrorListener())
<endif>
parser.setBuildParseTree(true)
<if(profile)>
let profiler = ProfilingATNSimulator(parser)
parser.setInterpreter(profiler)