Remove ANTLR's error listeners, which print on System.err
This commit is contained in:
parent
cf9dc5ab67
commit
51d0ec3083
|
@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.antlr.v4.runtime.CharStream;
|
import org.antlr.v4.runtime.CharStream;
|
||||||
import org.antlr.v4.runtime.CharStreams;
|
import org.antlr.v4.runtime.CharStreams;
|
||||||
import org.antlr.v4.runtime.CommonTokenStream;
|
import org.antlr.v4.runtime.CommonTokenStream;
|
||||||
|
import org.antlr.v4.runtime.ConsoleErrorListener;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -30,8 +31,10 @@ abstract class AbstractVariableExpander {
|
||||||
try (StringReader reader = new StringReader(input)) {
|
try (StringReader reader = new StringReader(input)) {
|
||||||
CharStream s = CharStreams.fromReader(reader);
|
CharStream s = CharStreams.fromReader(reader);
|
||||||
PostProcessingLexer lexer = new PostProcessingLexer(s);
|
PostProcessingLexer lexer = new PostProcessingLexer(s);
|
||||||
|
lexer.removeErrorListener(ConsoleErrorListener.INSTANCE);
|
||||||
CommonTokenStream tokens = new CommonTokenStream(lexer);
|
CommonTokenStream tokens = new CommonTokenStream(lexer);
|
||||||
PostProcessingParser parser = new PostProcessingParser(tokens);
|
PostProcessingParser parser = new PostProcessingParser(tokens);
|
||||||
|
parser.removeErrorListener(ConsoleErrorListener.INSTANCE);
|
||||||
Optional.ofNullable(errorListener).ifPresent(parser::addErrorListener);
|
Optional.ofNullable(errorListener).ifPresent(parser::addErrorListener);
|
||||||
PostProcessingParser.LineContext ctx = parser.line();
|
PostProcessingParser.LineContext ctx = parser.line();
|
||||||
ParserVisitor visitor = new ParserVisitor(variables);
|
ParserVisitor visitor = new ParserVisitor(variables);
|
||||||
|
|
Loading…
Reference in New Issue