com.alexmerz.graphviz
Class Parser

java.lang.Object
  extended by com.alexmerz.graphviz.Parser
All Implemented Interfaces:
ParserConstants

public class Parser
extends java.lang.Object
implements ParserConstants

The parser creates a list of Graph objects found in a Reader object.

Version:
$Id: graphviz.jj,v 1.5 2006/03/20 21:32:19 Alexander Exp $

Field Summary
 Token jj_nt
           
 boolean lookingAhead
           
 Token token
           
 ParserTokenManager token_source
           
 
Fields inherited from interface com.alexmerz.graphviz.ParserConstants
COMMA, DEFAULT, DIGRAPH, DOUBLE, EDGE, EDGE_DIRECTED, EDGE_UNDIRECTED, EOF, EQUAL, GRAPH, ID, IN_COMMENT, IN_COMMENT_OL, LB, LBRACE, LBRACKET, NODE, NUMBER, RBRACE, RBRACKET, SEMI, SPACE, STRICT, STRING, SUBGRAPH, tokenImage
 
Constructor Summary
Parser()
           
Parser(java.io.InputStream stream)
           
Parser(java.io.InputStream stream, java.lang.String encoding)
           
Parser(ParserTokenManager tm)
           
Parser(java.io.Reader stream)
           
 
Method Summary
 java.lang.String attrib_value()
          Production for the value of an attribute assignment
 java.util.Hashtable<java.lang.String,java.lang.String> attribute_list()
          Production for an attribute list
 java.lang.String[] attribute()
          Production for an attribute in an attribute list
 void disable_tracing()
           
 void edge_op()
          Production for the edge operator
 void edge()
          Production for an edge The source is a single node, a list of nodes (matrix) or a subgraph.
 void enable_tracing()
           
 ParseException generateParseException()
           
 void generic_attributes()
          Production for generic graph/edge/node attributes edge [color=blue]
 java.util.ArrayList<Graph> getGraphs()
          Returns the main Graphs found in the Reader stream
 Token getNextToken()
           
 Token getToken(int index)
           
 void graph_attrib_assign()
          Production for graph layout attributes (label="test")
 void graph(java.util.ArrayList<Graph> gglist)
          Production for a single graph
 void graphs(java.util.ArrayList<Graph> gglist)
          Production for all graph definitions in the stream
 Id id()
          Production for single id element
 void lb()
          Production for the statement ending yes lb is misleading..
 java.util.ArrayList<Node> matrix()
          Production for a list of nodes
 void node_listing()
          Production for listing of nodes (node1 node2 [color=grey];)
 PortNode node_port()
          Production for Node having port information (node:"e")
 Node node()
          Production for a single node
 boolean parse(java.io.Reader in)
          Parses a Graphviz document
 boolean parse(java.lang.StringBuffer sb)
          Parses a Graphviz document
 void reallist()
          Production for more then one statement in a graph
 void ReInit(java.io.InputStream stream)
           
 void ReInit(java.io.InputStream stream, java.lang.String encoding)
           
 void ReInit(ParserTokenManager tm)
           
 void ReInit(java.io.Reader stream)
           
 void sg_stmt_list()
          Production for the statements in a subgraph
 void single_node()
          Production for a single node on a line
 void stmt_list()
          Production for the statements in the graph
 void stmt()
          Production for the different types of statements
 Node subgraph()
          Production for a subgraph
 java.lang.String value()
          Production for a value
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public ParserTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

Parser

public Parser()

Parser

public Parser(java.io.InputStream stream)

Parser

public Parser(java.io.InputStream stream,
              java.lang.String encoding)

Parser

public Parser(java.io.Reader stream)

Parser

public Parser(ParserTokenManager tm)
Method Detail

getGraphs

public java.util.ArrayList<Graph> getGraphs()
Returns the main Graphs found in the Reader stream

Returns:
the list of main Graphs

parse

public boolean parse(java.io.Reader in)
              throws ParseException
Parses a Graphviz document

Parameters:
in - the Reader to parse
Returns:
normally true should be returned, if false then something in the JDK is broken...
Throws:
ParseException

parse

public boolean parse(java.lang.StringBuffer sb)
              throws ParseException
Parses a Graphviz document

Parameters:
sb - the StringBuffer containing the document
Returns:
normally true should be returned, if false then something in the JDK is broken...
Throws:
ParseException

graphs

public final void graphs(java.util.ArrayList<Graph> gglist)
                  throws ParseException
Production for all graph definitions in the stream

Throws:
ParseException

graph

public final void graph(java.util.ArrayList<Graph> gglist)
                 throws ParseException
Production for a single graph

Throws:
ParseException

stmt_list

public final void stmt_list()
                     throws ParseException
Production for the statements in the graph

Throws:
ParseException

reallist

public final void reallist()
                    throws ParseException
Production for more then one statement in a graph

Throws:
ParseException

stmt

public final void stmt()
                throws ParseException
Production for the different types of statements

Throws:
ParseException

lb

public final void lb()
              throws ParseException
Production for the statement ending yes lb is misleading..

Throws:
ParseException

edge

public final void edge()
                throws ParseException
Production for an edge The source is a single node, a list of nodes (matrix) or a subgraph. The target is a single node, a list of nodes (matrix) or a subgraph.

Throws:
ParseException

edge_op

public final void edge_op()
                   throws ParseException
Production for the edge operator

Throws:
ParseException

matrix

public final java.util.ArrayList<Node> matrix()
                                       throws ParseException
Production for a list of nodes

Throws:
ParseException

generic_attributes

public final void generic_attributes()
                              throws ParseException
Production for generic graph/edge/node attributes edge [color=blue]

Throws:
ParseException

subgraph

public final Node subgraph()
                    throws ParseException
Production for a subgraph

Throws:
ParseException

sg_stmt_list

public final void sg_stmt_list()
                        throws ParseException
Production for the statements in a subgraph

Throws:
ParseException

graph_attrib_assign

public final void graph_attrib_assign()
                               throws ParseException
Production for graph layout attributes (label="test")

Throws:
ParseException

node_port

public final PortNode node_port()
                         throws ParseException
Production for Node having port information (node:"e")

Throws:
ParseException

node_listing

public final void node_listing()
                        throws ParseException
Production for listing of nodes (node1 node2 [color=grey];)

Throws:
ParseException

single_node

public final void single_node()
                       throws ParseException
Production for a single node on a line

Throws:
ParseException

attribute_list

public final java.util.Hashtable<java.lang.String,java.lang.String> attribute_list()
                                                                            throws ParseException
Production for an attribute list

Throws:
ParseException

attribute

public final java.lang.String[] attribute()
                                   throws ParseException
Production for an attribute in an attribute list

Throws:
ParseException

attrib_value

public final java.lang.String attrib_value()
                                    throws ParseException
Production for the value of an attribute assignment

Throws:
ParseException

node

public final Node node()
                throws ParseException
Production for a single node

Throws:
ParseException

id

public final Id id()
            throws ParseException
Production for single id element

Throws:
ParseException

value

public final java.lang.String value()
                             throws ParseException
Production for a value

Throws:
ParseException

ReInit

public void ReInit(java.io.InputStream stream)

ReInit

public void ReInit(java.io.InputStream stream,
                   java.lang.String encoding)

ReInit

public void ReInit(java.io.Reader stream)

ReInit

public void ReInit(ParserTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()