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

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

Introduction

In this page you can find the example usage for org.antlr.v4.runtime.atn LexerATNSimulator 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 NaturalLanguageStrategyLexer l) {
    final int originalSize = l.getInterpreter().decisionToDFA.length;
    final DFA[] emptyDFA = new DFA[originalSize]; // give our own array so the static one isn't used
    final LexerATNSimulator newInterpreter = new LexerATNSimulator(l, l.getATN(), emptyDFA,
            new PredictionContextCache());
    newInterpreter.clearDFA(); // initialize our array so that the lexer functions properly
    l.setInterpreter(newInterpreter); // replace the interpreter to bypass all static caches
}