Class TopLevelClass.ParseException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--TopLevelClass.ParseException
All Implemented Interfaces:
Serializable
Enclosing class:
TopLevelClass

public static class TopLevelClass.ParseException
extends Exception

Describes a error of a text.

The program generated by ¬<><∪∪ throws this exception only if the parsed text has some syntactical error. But, the users of ¬<><∪∪ may throw this exception if it has some semantic error.

Since:
notavaCC 1.0
See Also:
Serialized Form

Nested Class Summary
static class TopLevelClass.ParseException.AmbiguousGrammarError
          Indicates the source of the notavaCC, which generates this Java program, has ambiguity.
 
Constructor Summary
TopLevelClass.ParseException(String msg, String sourceName, int index, int line, int column)
          Constructs an exception.
TopLevelClass.ParseException(String msg, TopLevelClass.Token position)
          Constructs an exception.
 
Method Summary
 int getColumn()
          Returns the column number where the exception is occured.
 String getGCCStylePositionString()
          Returns the GNU-Compiler-Collection-style string that describes the position of the error.
 int getIndex()
          Returns the index number where the exception is occured.
 int getLine()
          Returns the line number where the exception is occured.
 String getSourceName()
          Returns the source name where the exception is occured.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TopLevelClass.ParseException

public TopLevelClass.ParseException(String msg,
                                    String sourceName,
                                    int index,
                                    int line,
                                    int column)
Constructs an exception.

Parameters:
msg - a message to describes the error.
sourceName - the source name where the exception is occured, or null if not supported.
index - the index number where the exception is occured, or -1 if not supported.
line - the line number where the exception is occured, or -1 if not supported.
column - the column number where the exception is occured, or -1 if not supported.
Since:
notavaCC 1.0

TopLevelClass.ParseException

public TopLevelClass.ParseException(String msg,
                                    TopLevelClass.Token position)
Constructs an exception.

Parameters:
msg - a message to describes the error.
position - a token that describes the position of the error.
Since:
notavaCC 1.0
Method Detail

getSourceName

public final String getSourceName()
                           throws UnsupportedOperationException
Returns the source name where the exception is occured.

Returns:
the source name where the exception is occured.
Throws:
UnsupportedOperationException - if the method is not suported.
Since:
notavaCC 1.0

getIndex

public final int getIndex()
                   throws UnsupportedOperationException
Returns the index number where the exception is occured.

Returns:
the index number where the exception is occured.
Throws:
UnsupportedOperationException - if the method is not suported.
Since:
notavaCC 1.0

getLine

public final int getLine()
                  throws UnsupportedOperationException
Returns the line number where the exception is occured.

Returns:
the line number where the exception is occured.
Throws:
UnsupportedOperationException - if the method is not suported.
Since:
notavaCC 1.0

getColumn

public final int getColumn()
                    throws UnsupportedOperationException
Returns the column number where the exception is occured.

Returns:
the column number where the exception is occured.
Throws:
UnsupportedOperationException - if the method is not suported.
Since:
notavaCC 1.0

getGCCStylePositionString

public final String getGCCStylePositionString()
                                       throws UnsupportedOperationException
Returns the GNU-Compiler-Collection-style string that describes the position of the error.

This method throws an UnsupportedOperationException if getSourceName() is not supported. Otherwise, it returns getSourceName() if getLine() is not supported. Otherwise, it returns getSourceName() + ":" + getLine() if getColumn() is not supported. Otherwise, it returns getSourceName() + ":" + getLine() + ":" + getColumn().

Returns:
the GCC-style string describing the position of the error.
Throws:
UnsupportedOperationException - getSourceName() was not suppoted.
Since:
notavaCC 1.0