net.percederberg.grammatica.parser
Class ParserCreationException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended bynet.percederberg.grammatica.parser.ParserCreationException
All Implemented Interfaces:
java.io.Serializable

public class ParserCreationException
extends java.lang.Exception

A parser creation exception. This exception is used for signalling an error in the token or production patterns, making it impossible to create a working parser or tokenizer.

See Also:
Serialized Form

Field Summary
static int INFINITE_LOOP_ERROR
          The infinite loop error type constant.
static int INHERENT_AMBIGUITY_ERROR
          The inherent ambiguity error type constant.
static int INTERNAL_ERROR
          The internal error type constant.
static int INVALID_PARSER_ERROR
          The invalid parser error type constant.
static int INVALID_PRODUCTION_ERROR
          The invalid production error type constant.
static int INVALID_TOKEN_ERROR
          The invalid token error type constant.
 
Constructor Summary
ParserCreationException(int type, java.lang.String info)
          Creates a new parser creation exception.
ParserCreationException(int type, java.lang.String name, java.lang.String info)
          Creates a new parser creation exception.
ParserCreationException(int type, java.lang.String name, java.lang.String info, java.util.ArrayList details)
          Creates a new parser creation exception.
 
Method Summary
 java.lang.String getDetails()
          Returns the detailed error information as a string
 int getErrorType()
          Returns the error type.
 java.lang.String getInfo()
          Returns the additional error information.
 java.lang.String getMessage()
          Returns the error message.
 java.lang.String getName()
          Returns the token or production name.
 
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
 

Field Detail

INTERNAL_ERROR

public static final int INTERNAL_ERROR
The internal error type constant. This type is only used to signal an error that is a result of a bug in the parser or tokenizer code.

See Also:
Constant Field Values

INVALID_PARSER_ERROR

public static final int INVALID_PARSER_ERROR
The invalid parser error type constant. This type is used when the parser as such is invalid. This error is typically caused by using a parser without any patterns.

See Also:
Constant Field Values

INVALID_TOKEN_ERROR

public static final int INVALID_TOKEN_ERROR
The invalid token error type constant. This type is used when a token pattern is erroneous. This error is typically caused by an invalid pattern type or an erroneous regular expression.

See Also:
Constant Field Values

INVALID_PRODUCTION_ERROR

public static final int INVALID_PRODUCTION_ERROR
The invalid production error type constant. This type is used when a production pattern is erroneous. This error is typically caused by referencing undeclared productions, or violating some other production pattern constraint.

See Also:
Constant Field Values

INFINITE_LOOP_ERROR

public static final int INFINITE_LOOP_ERROR
The infinite loop error type constant. This type is used when an infinite loop has been detected in the grammar. One of the productions in the loop will be reported.

See Also:
Constant Field Values

INHERENT_AMBIGUITY_ERROR

public static final int INHERENT_AMBIGUITY_ERROR
The inherent ambiguity error type constant. This type is used when the set of production patterns (i.e. the grammar) contains ambiguities that cannot be resolved.

See Also:
Constant Field Values
Constructor Detail

ParserCreationException

public ParserCreationException(int type,
                               java.lang.String info)
Creates a new parser creation exception.

Parameters:
type - the parse error type
info - the additional error information

ParserCreationException

public ParserCreationException(int type,
                               java.lang.String name,
                               java.lang.String info)
Creates a new parser creation exception.

Parameters:
type - the parse error type
name - the token or production pattern name
info - the additional error information

ParserCreationException

public ParserCreationException(int type,
                               java.lang.String name,
                               java.lang.String info,
                               java.util.ArrayList details)
Creates a new parser creation exception.

Parameters:
type - the parse error type
name - the token or production pattern name
info - the additional error information
details - the error details list
Method Detail

getErrorType

public int getErrorType()
Returns the error type.

Returns:
the error type

getName

public java.lang.String getName()
Returns the token or production name.

Returns:
the token or production name

getInfo

public java.lang.String getInfo()
Returns the additional error information.

Returns:
the additional error information

getDetails

public java.lang.String getDetails()
Returns the detailed error information as a string

Returns:
the detailed error information

getMessage

public java.lang.String getMessage()
Returns the error message. This message will contain all the information available.

Returns:
the error message