Package org.antlr.tool
Class DOTGenerator
- java.lang.Object
-
- org.antlr.tool.DOTGenerator
-
public class DOTGenerator extends java.lang.ObjectThe DOT (part of graphviz) generation aspect.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringarrowheadprotected Grammargrammarprotected java.util.SetmarkedStatesTo prevent infinite recursion when walking state machines, record which states we've visited.protected java.lang.Stringrankdirstatic org.antlr.stringtemplate.StringTemplateGroupstlibLibrary of output templates; useformat static booleanSTRIP_NONREDUCED_STATES
-
Constructor Summary
Constructors Constructor Description DOTGenerator(Grammar grammar)This aspect is associated with a grammar
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetArrowheadType()java.lang.StringgetDOT(State startState)Return a String containing a DOT description that, when displayed, will show the incoming state machine visually.protected java.lang.StringgetEdgeLabel(Transition edge)Fix edge strings so they print out in DOT properly; generate any gated predicates on edge too.java.lang.StringgetRankdir()protected java.lang.StringgetStateLabel(State s)voidsetArrowheadType(java.lang.String arrowhead)voidsetRankdir(java.lang.String rankdir)protected voidwalkCreatingDFADOT(org.antlr.stringtemplate.StringTemplate dot, DFAState s)Do a depth-first walk of the state machine graph and fill a DOT description template.protected voidwalkRuleNFACreatingDOT(org.antlr.stringtemplate.StringTemplate dot, State s)Do a depth-first walk of the state machine graph and fill a DOT description template.
-
-
-
Field Detail
-
STRIP_NONREDUCED_STATES
public static final boolean STRIP_NONREDUCED_STATES
- See Also:
- Constant Field Values
-
arrowhead
protected java.lang.String arrowhead
-
rankdir
protected java.lang.String rankdir
-
stlib
public static org.antlr.stringtemplate.StringTemplateGroup stlib
Library of output templates; useformat
-
markedStates
protected java.util.Set markedStates
To prevent infinite recursion when walking state machines, record which states we've visited. Make a new set every time you start walking in case you reuse this object.
-
grammar
protected Grammar grammar
-
-
Constructor Detail
-
DOTGenerator
public DOTGenerator(Grammar grammar)
This aspect is associated with a grammar
-
-
Method Detail
-
getDOT
public java.lang.String getDOT(State startState)
Return a String containing a DOT description that, when displayed, will show the incoming state machine visually. All nodes reachable from startState will be included.
-
walkCreatingDFADOT
protected void walkCreatingDFADOT(org.antlr.stringtemplate.StringTemplate dot, DFAState s)Do a depth-first walk of the state machine graph and fill a DOT description template. Keep filling the states and edges attributes.
-
walkRuleNFACreatingDOT
protected void walkRuleNFACreatingDOT(org.antlr.stringtemplate.StringTemplate dot, State s)Do a depth-first walk of the state machine graph and fill a DOT description template. Keep filling the states and edges attributes. We know this is an NFA for a rule so don't traverse edges to other rules and don't go past rule end state.
-
getEdgeLabel
protected java.lang.String getEdgeLabel(Transition edge)
Fix edge strings so they print out in DOT properly; generate any gated predicates on edge too.
-
getStateLabel
protected java.lang.String getStateLabel(State s)
-
getArrowheadType
public java.lang.String getArrowheadType()
-
setArrowheadType
public void setArrowheadType(java.lang.String arrowhead)
-
getRankdir
public java.lang.String getRankdir()
-
setRankdir
public void setRankdir(java.lang.String rankdir)
-
-