use of org.antlr.v4.automata.ATNPrinter in project antlr4 by antlr.
the class TestATNConstruction method checkTokensRule.
void checkTokensRule(LexerGrammar g, String modeName, String expecting) {
// }
if (modeName == null)
modeName = "DEFAULT_MODE";
if (g.modes.get(modeName) == null) {
System.err.println("no such mode " + modeName);
return;
}
ParserATNFactory f = new LexerATNFactory(g);
ATN nfa = f.createATN();
ATNState startState = nfa.modeNameToStartState.get(modeName);
ATNPrinter serializer = new ATNPrinter(g, startState);
String result = serializer.asString();
// System.out.print(result);
assertEquals(expecting, result);
}
Aggregations