All Packages Class Hierarchy This Package Previous Next Index
Class att.grappa.Parser
java.lang.Object
|
+----java_cup.runtime.lr_parser
|
+----att.grappa.Parser
- public class Parser
- extends lr_parser
This class provides a parser for the dot graph representation format.
It is used in conjunction with JavaCup, a yacc-like parser generator
originally by:
Scott E. Hudson
Graphics Visualization and Usability Center
Georgia Institute of Technology
and more recently modified and maintained by
a number of people at Princeton University.
- Version:
- 1.1, 30 Sep 1999; Copyright 1996 - 1999 by AT&T Corp.
- Author:
- John Mocenigo, Research @ AT&T Labs
-
_action_table
- parse action table
-
_production_table
- production table
-
_reduce_table
- reduce_goto table
-
action_obj
- instance of action encapsulation class
-
Parser()
- constructor
-
Parser(InputStream)
- A convenience constructor equivalent to
Parser(inputStream,null,null)
.
-
Parser(InputStream, OutputStream)
- A convenience constructor equivalent to
Parser(inputStream,errorStream,null)
.
-
Parser(InputStream, OutputStream, Graph)
- Create an instance of
Parser
with input, error output and
a supplied Graph
object.
-
Parser(Reader)
- A convenience constructor equivalent to
Parser(inputReader,null,null)
.
-
Parser(Reader, PrintWriter)
- A convenience constructor equivalent to
Parser(inputReader,errorWriter,null)
.
-
Parser(Reader, PrintWriter, Graph)
- Create an instance of
Parser
with input, error output and
a supplied Graph
object.
-
action_table()
- access to parse action table
-
debug_message(int, String)
- Write a debugging message to the error stream.
-
debug_message(String)
- Write a debugging message to the error stream.
-
debug_parse(int)
- Invokes the parser in debug mode.
-
do_action(int, lr_parser, Stack, int)
- invoke a user supplied parse action
-
EOF_sym()
- EOF Symbol index
-
error_sym()
- error Symbol index
-
getDebugLevel()
- Get the debug level for this parser.
-
getErrorWriter()
- Get the error writer, if any, for this parser.
-
getGraph()
- Get the graph resulting from the parsing operations.
-
getLexer()
- Get the
Lexer
object associated with this parser.
-
init_actions()
- action encapsulation object initializer
-
production_table()
- access to production table
-
reduce_table()
- access to reduce_goto table
-
report_error(String, Object)
- Report a fatal error.
-
report_warning(String, Object)
- Report a non-fatal error.
-
scan()
- scan to get the next Symbol
-
start_production()
- start production
-
start_state()
- start state
-
user_init()
- user initialization
_production_table
protected static final short _production_table[][]
- production table
_action_table
protected static final short _action_table[][]
- parse action table
_reduce_table
protected static final short _reduce_table[][]
- reduce_goto table
action_obj
protected CUP$actions action_obj
- instance of action encapsulation class
Parser
public Parser()
- constructor
Parser
public Parser(Reader inputReader,
PrintWriter errorWriter,
Graph graph)
- Create an instance of
Parser
with input, error output and
a supplied Graph
object. The graph object is cleared (reset) before
new graph components are added to it by this parsing operation.
- Parameters:
- inputReader - input
Reader
object
- errorWriter - error output
Writer
object (or null to suppress error output)
- graph -
Graph
object for storing parsed graph information (or null to create a new object)
Parser
public Parser(Reader inputReader,
PrintWriter errorWriter)
- A convenience constructor equivalent to
Parser(inputReader,errorWriter,null)
.
- Parameters:
- inputReader - input
Reader
object
- errorWriter - error output
Writer
object (or null to suppress error output)
Parser
public Parser(Reader inputReader)
- A convenience constructor equivalent to
Parser(inputReader,null,null)
.
- Parameters:
- inputReader - input
Reader
object
Parser
public Parser(InputStream inputStream,
OutputStream errorStream,
Graph graph)
- Create an instance of
Parser
with input, error output and
a supplied Graph
object. The input stream is converted to
a Reader
and the error stream is converted to a Writer
.
- Parameters:
- inputStream - input
InputStream
object
- errorStream - error output
OutputStream
object (or null to suppress error output)
- graph -
Graph
object for storing parsed graph information (or null to create a new object)
Parser
public Parser(InputStream inputStream,
OutputStream errorStream)
- A convenience constructor equivalent to
Parser(inputStream,errorStream,null)
.
- Parameters:
- inputStream - input
InputStream
object
- errorStream - error output
OutputStream
object
Parser
public Parser(InputStream inputStream)
- A convenience constructor equivalent to
Parser(inputStream,null,null)
.
- Parameters:
- inputStream - input
InputStream
object
production_table
public short[][] production_table()
- access to production table
- Overrides:
- production_table in class lr_parser
action_table
public short[][] action_table()
- access to parse action table
- Overrides:
- action_table in class lr_parser
reduce_table
public short[][] reduce_table()
- access to reduce_goto table
- Overrides:
- reduce_table in class lr_parser
init_actions
protected void init_actions()
- action encapsulation object initializer
- Overrides:
- init_actions in class lr_parser
do_action
public Symbol do_action(int act_num,
lr_parser parser,
Stack stack,
int top) throws Exception
- invoke a user supplied parse action
- Overrides:
- do_action in class lr_parser
start_state
public int start_state()
- start state
- Overrides:
- start_state in class lr_parser
start_production
public int start_production()
- start production
- Overrides:
- start_production in class lr_parser
EOF_sym
public int EOF_sym()
- EOF Symbol index
- Overrides:
- EOF_sym in class lr_parser
error_sym
public int error_sym()
- error Symbol index
- Overrides:
- error_sym in class lr_parser
user_init
public void user_init() throws Exception
- user initialization
- Overrides:
- user_init in class lr_parser
scan
public Symbol scan() throws Exception
- scan to get the next Symbol
- Overrides:
- scan in class lr_parser
getLexer
public Lexer getLexer()
- Get the
Lexer
object associated with this parser.
- Returns:
- the associated lexical analyzer.
getErrorWriter
public PrintWriter getErrorWriter()
- Get the error writer, if any, for this parser.
- Returns:
- the error writer for this parser.
getDebugLevel
public int getDebugLevel()
- Get the debug level for this parser.
The debug level is set to a non-zero value by calling
debug_parse
.
- Returns:
- the debug level of this parser.
- See Also:
- debug_parse
report_error
public void report_error(String message,
Object info) throws GraphParserException
- Report a fatal error.
Calling this method will throw a
GraphParserException
.
- Parameters:
- message - the error message to send to the error stream and include in the thrown exception
- info - not used
- Throws: GraphParserException
- whenver this method is called
- Overrides:
- report_error in class lr_parser
report_warning
public void report_warning(String message,
Object info)
- Report a non-fatal error.
- Parameters:
- message - the warning message to send to the error stream, if the stream non-null.
- info - not used
debug_message
public void debug_message(String message)
- Write a debugging message to the error stream.
The debug level of the message is 5.
- Parameters:
- message - the debug message to send to the error stream, if the stream non-null.
- Overrides:
- debug_message in class lr_parser
- See Also:
- debug_message
debug_message
public void debug_message(int level,
String message)
- Write a debugging message to the error stream.
A message is written only if the error stream is not null and the
debug level of the message is greater than or equal to the debugging
level of the parser.
- Parameters:
- level - the level of the message
- message - the debug message to send to the error stream, if the stream non-null.
- See Also:
- getDebugLevel
debug_parse
public Symbol debug_parse(int debug) throws Exception
- Invokes the parser in debug mode.
The lowering the debug level reduces the amount of debugging output.
A level of 0 inhibits all debugging messages, generally a level of 10
will let all messages get through.
- Parameters:
- debug - the debug level to use for filtering debug messages based on priority.
- Throws: Exception
- if
parse()
does
getGraph
public Graph getGraph()
- Get the graph resulting from the parsing operations.
- Returns:
- the graph generated from the input.
All Packages Class Hierarchy This Package Previous Next Index