use of org.antlr.codegen.CodeGenerator in project antlrworks by antlr.
the class DecisionDFA method getDOTString.
@Override
public String getDOTString() throws Exception {
DecisionDFAEngine engine = window.decisionDFAEngine;
Grammar g;
int adjustedColumn = getDecisionColumn(g = engine.getDiscoveredParserGrammar());
if (adjustedColumn == -1)
adjustedColumn = getDecisionColumn(g = engine.getDiscoveredLexerGrammar());
if (adjustedColumn == -1)
throw new Exception("No decision in the current line");
CodeGenerator generator = new CodeGenerator(new Tool(), g, (String) g.getOption("language"));
DFA dfa = g.getLookaheadDFAFromPositionInFile(line, adjustedColumn);
decisionNumber = dfa.getDecisionNumber();
DOTGenerator dg = new DOTGenerator(g);
g.setCodeGenerator(generator);
dg.setArrowheadType("none");
// Left-to-right
dg.setRankdir("LR");
return dg.getDOT(dfa.startState);
}
Aggregations