Search in sources :

Example 1 with ProfilingATNSimulator

use of org.antlr.v4.runtime.atn.ProfilingATNSimulator in project antlr4 by antlr.

the class Parser method setProfile.

/**
 * @since 4.3
 */
public void setProfile(boolean profile) {
    ParserATNSimulator interp = getInterpreter();
    PredictionMode saveMode = interp.getPredictionMode();
    if (profile) {
        if (!(interp instanceof ProfilingATNSimulator)) {
            setInterpreter(new ProfilingATNSimulator(this));
        }
    } else if (interp instanceof ProfilingATNSimulator) {
        ParserATNSimulator sim = new ParserATNSimulator(this, getATN(), interp.decisionToDFA, interp.getSharedContextCache());
        setInterpreter(sim);
    }
    getInterpreter().setPredictionMode(saveMode);
}
Also used : ProfilingATNSimulator(org.antlr.v4.runtime.atn.ProfilingATNSimulator) ParserATNSimulator(org.antlr.v4.runtime.atn.ParserATNSimulator) PredictionMode(org.antlr.v4.runtime.atn.PredictionMode)

Example 2 with ProfilingATNSimulator

use of org.antlr.v4.runtime.atn.ProfilingATNSimulator in project antlr4 by tunnelvisionlabs.

the class Parser method setProfile.

/**
 * @since 4.3
 */
public void setProfile(boolean profile) {
    ParserATNSimulator interp = getInterpreter();
    if (profile) {
        if (!(interp instanceof ProfilingATNSimulator)) {
            setInterpreter(new ProfilingATNSimulator(this));
        }
    } else if (interp instanceof ProfilingATNSimulator) {
        setInterpreter(new ParserATNSimulator(this, getATN()));
    }
    getInterpreter().setPredictionMode(interp.getPredictionMode());
}
Also used : ProfilingATNSimulator(org.antlr.v4.runtime.atn.ProfilingATNSimulator) ParserATNSimulator(org.antlr.v4.runtime.atn.ParserATNSimulator)

Aggregations

ParserATNSimulator (org.antlr.v4.runtime.atn.ParserATNSimulator)2 ProfilingATNSimulator (org.antlr.v4.runtime.atn.ProfilingATNSimulator)2 PredictionMode (org.antlr.v4.runtime.atn.PredictionMode)1