jfun.parsec
Class ParserException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by jfun.parsec.ParserException
All Implemented Interfaces:
java.io.Serializable

public class ParserException
extends java.lang.RuntimeException

ParserException is thrown when a grammar error happens.

Author:
Ben Yu 2004-11-12
See Also:
Serialized Form

Constructor Summary
ParserException(ParseError err, java.lang.String mname, Pos pos)
          Create a ParserException object.
ParserException(java.lang.String message, ParseError err, java.lang.String mname, Pos pos)
          Create a ParserException object.
ParserException(java.lang.String message, java.lang.Throwable cause, ParseError err, java.lang.String mname, Pos pos)
           
ParserException(java.lang.Throwable cause, ParseError err, java.lang.String mname, Pos pos)
           
 
Method Summary
 int getColumnNo()
          Gets the column number of the error.
 ParseError getError()
          Get the ParseError object.
 int getLineNo()
          Gets the line number of the error.
 java.lang.String getMessage()
          Get the default formatted error message.
 java.lang.String getModuleName()
          Gets the module name.
 java.util.Stack getParsingTrace()
          Get the parsing trace.
 void printParsingTrace()
          Prints the parsing trace to the standard error output.
 void printParsingTrace(java.io.PrintStream out)
          Print the parsing trace.
 void printParsingTrace(java.io.PrintWriter out)
          Print the resultion trace.
 void printStackTrace(java.io.PrintStream s)
           
 void printStackTrace(java.io.PrintWriter s)
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParserException

public ParserException(ParseError err,
                       java.lang.String mname,
                       Pos pos)
Create a ParserException object.

Parameters:
err - the ParseError object.
mname - the module name.
pos - the position.

ParserException

public ParserException(java.lang.String message,
                       ParseError err,
                       java.lang.String mname,
                       Pos pos)
Create a ParserException object.

Parameters:
message - the error message.
err - the ParseError object.
mname - the module name.
pos - the position.

ParserException

public ParserException(java.lang.Throwable cause,
                       ParseError err,
                       java.lang.String mname,
                       Pos pos)
Parameters:
cause - the exception that causes this.
err - the ParseError object.
mname - the module name.
pos - the position.

ParserException

public ParserException(java.lang.String message,
                       java.lang.Throwable cause,
                       ParseError err,
                       java.lang.String mname,
                       Pos pos)
Parameters:
message - the error message.
cause - the exception that causes this.
err - the ParseError object.
mname - the module name.
pos - the position.
Method Detail

getParsingTrace

public java.util.Stack getParsingTrace()
Get the parsing trace.

Returns:
the parsing trace with objects of ParsingFrame as the elements.

printParsingTrace

public void printParsingTrace(java.io.PrintStream out)
Print the parsing trace.

Parameters:
out - the output stream.

printParsingTrace

public void printParsingTrace(java.io.PrintWriter out)
Print the resultion trace.

Parameters:
out - the output writer.

printParsingTrace

public void printParsingTrace()
Prints the parsing trace to the standard error output.


printStackTrace

public void printStackTrace(java.io.PrintStream s)
Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

public void printStackTrace(java.io.PrintWriter s)
Overrides:
printStackTrace in class java.lang.Throwable

getError

public final ParseError getError()
Get the ParseError object.

Returns:
Returns the err.

getMessage

public java.lang.String getMessage()
Get the default formatted error message.

Overrides:
getMessage in class java.lang.Throwable
See Also:
Throwable.getMessage()

getModuleName

public java.lang.String getModuleName()
Gets the module name.

Returns:
the module name.

getLineNo

public int getLineNo()
Gets the line number of the error.

Returns:
the line number.

getColumnNo

public int getColumnNo()
Gets the column number of the error.

Returns:
the column number.