Example usage for org.antlr.v4.runtime.atn ParserATNSimulator clearDFA

List of usage examples for org.antlr.v4.runtime.atn ParserATNSimulator clearDFA

Introduction

In this page you can find the example usage for org.antlr.v4.runtime.atn ParserATNSimulator clearDFA.

Prototype

@Override
    public void clearDFA() 

Source Link

Usage

From source file:com.github.robozonky.strategy.natural.SideEffectFreeParser.java

License:Apache License

private static void modifyInterpreter(final NaturalLanguageStrategyParser p) {
    final int originalSize = p.getInterpreter().decisionToDFA.length;
    final DFA[] emptyDFA = new DFA[originalSize]; // give our own array so the static one isn't used
    final ParserATNSimulator newInterpreter = new ParserATNSimulator(p, p.getATN(), emptyDFA,
            new PredictionContextCache());
    newInterpreter.clearDFA(); // initialize our array so that the parser functions properly
    p.setInterpreter(newInterpreter); // replace the interpreter to bypass all static caches
}