net.percederberg.grammatica
Class GrammarException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--net.percederberg.grammatica.GrammarException
All Implemented Interfaces:
java.io.Serializable

public class GrammarException
extends java.lang.Exception

A grammar validation exception. This exception is used for signalling an error in the grammar file.

See Also:
Serialized Form

Constructor Summary
GrammarException(java.lang.String file, java.lang.String message)
          Creates a new grammar exception.
GrammarException(java.lang.String file, java.lang.String message, int startLine, int endLine)
          Creates a new grammar exception.
 
Method Summary
 int getEndLine()
          Returns the end line number for the error.
 java.lang.String getErrorMessage()
          Returns the error message.
 java.lang.String getFile()
          Returns the grammar file name.
 java.lang.String getMessage()
          Returns the detailed error message.
 int getStartLine()
          Returns the start line number for the error.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, 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

GrammarException

public GrammarException(java.lang.String file,
                        java.lang.String message)
Creates a new grammar exception.

Parameters:
file - the grammar file name
message - the detailed error message

GrammarException

public GrammarException(java.lang.String file,
                        java.lang.String message,
                        int startLine,
                        int endLine)
Creates a new grammar exception.

Parameters:
file - the grammar file name
message - the detailed error message
startLine - the starting line number, or -1 for unknown
endLine - the ending line number, or -1 for unknown
Method Detail

getFile

public java.lang.String getFile()
Returns the grammar file name.

Returns:
the grammar file name

getStartLine

public int getStartLine()
Returns the start line number for the error.

Returns:
the starting line number, or -1 if unknown

getEndLine

public int getEndLine()
Returns the end line number for the error.

Returns:
the ending line number, or -1 if unknown

getMessage

public java.lang.String getMessage()
Returns the detailed error message. This message will contain the same string as getErrorMessage(), but with line number information appended.

Overrides:
getMessage in class java.lang.Throwable
Returns:
the detailed error message

getErrorMessage

public java.lang.String getErrorMessage()
Returns the error message.

Returns:
the error message.