org.antlr.tool
Class DOTGenerator

java.lang.Object
  extended by org.antlr.tool.DOTGenerator

public class DOTGenerator
extends Object

The DOT (part of graphviz) generation aspect.


Field Summary
protected  String arrowhead
           
protected  Grammar grammar
           
protected  Set markedStates
          To prevent infinite recursion when walking state machines, record which states we've visited.
protected  String rankdir
           
static org.stringtemplate.v4.STGroup stlib
          Library of output templates; use format
static boolean STRIP_NONREDUCED_STATES
           
 
Constructor Summary
DOTGenerator(Grammar grammar)
          This aspect is associated with a grammar
 
Method Summary
 String getArrowheadType()
           
 String getDOT(State startState)
          Return a String containing a DOT description that, when displayed, will show the incoming state machine visually.
protected  String getEdgeLabel(Transition edge)
          Fix edge strings so they print out in DOT properly; generate any gated predicates on edge too.
 String getRankdir()
           
protected  String getStateLabel(State s)
           
 void setArrowheadType(String arrowhead)
           
 void setRankdir(String rankdir)
           
protected  void walkCreatingDFADOT(org.stringtemplate.v4.ST dot, DFAState s)
          Do a depth-first walk of the state machine graph and fill a DOT description template.
protected  void walkRuleNFACreatingDOT(org.stringtemplate.v4.ST dot, State s)
          Do a depth-first walk of the state machine graph and fill a DOT description template.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRIP_NONREDUCED_STATES

public static final boolean STRIP_NONREDUCED_STATES
See Also:
Constant Field Values

arrowhead

protected String arrowhead

rankdir

protected String rankdir

stlib

public static org.stringtemplate.v4.STGroup stlib
Library of output templates; use format


markedStates

protected 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 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.stringtemplate.v4.ST 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.stringtemplate.v4.ST 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 String getEdgeLabel(Transition edge)
Fix edge strings so they print out in DOT properly; generate any gated predicates on edge too.


getStateLabel

protected String getStateLabel(State s)

getArrowheadType

public String getArrowheadType()

setArrowheadType

public void setArrowheadType(String arrowhead)

getRankdir

public String getRankdir()

setRankdir

public void setRankdir(String rankdir)


Copyright © 2011. All Rights Reserved.