Classes | Functions
rve_interface_gen::antlr3::dottreegen Namespace Reference

Classes

class  DOTTreeGenerator

Functions

def toDOT

Detailed Description

@package antlr3.dottreegenerator
@brief ANTLR3 runtime package, tree module

This module contains all support classes for AST construction and tree parsers.


Function Documentation

def rve_interface_gen.antlr3.dottreegen.toDOT (   tree,
  adaptor = None,
  treeST = DOTTreeGenerator._treeST,
  edgeST = DOTTreeGenerator._edgeST 
)
Generate DOT (graphviz) for a whole tree not just a node.
For example, 3+4*5 should generate:

digraph {
    node [shape=plaintext, fixedsize=true, fontsize=11, fontname="Courier",
        width=.4, height=.2];
    edge [arrowsize=.7]
    "+"->3
    "+"->"*"
    "*"->4
    "*"->5
}

Return the ST not a string in case people want to alter.

Takes a Tree interface object.

Example of invokation:

    import antlr3
    import antlr3.extras

    input = antlr3.ANTLRInputStream(sys.stdin)
    lex = TLexer(input)
    tokens = antlr3.CommonTokenStream(lex)
    parser = TParser(tokens)
    tree = parser.e().tree
    print tree.toStringTree()
    st = antlr3.extras.toDOT(t)
    print st
    

Definition at line 174 of file dottreegen.py.



rve_interface_gen
Author(s): Josh Faust
autogenerated on Wed Dec 11 2013 14:31:00