/** * @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); }
/** * Construct a {@link BatfishParserATNSimulator} from a {@link ParserATNSimulator} * * @param parent The {@link ParserATNSimulator} to emulate modulo {@link #adaptivePredict}. */ public BatfishParserATNSimulator(ParserATNSimulator parent) { super(parent.getParser(), parent.atn, parent.decisionToDFA, parent.getSharedContextCache()); this.setPredictionMode(parent.getPredictionMode()); _parser = (BatfishParser) parser; }
/** * @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()); }
/** * @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); }
/** * @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); }