com.agentfactory.common.parser
Class SemanticError

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.agentfactory.common.parser.SemanticError
All Implemented Interfaces:
java.io.Serializable

public class SemanticError
extends java.lang.Exception

This exception is thrown whenever one of the visitors detects a semantic error in the source code of the program. Semantic errors are errors that arise within syntactically correct code (e.g. a repeated activity identifier). It is designed to generate an error message that complies with the Java error reporting format. Current errors consist of:

TODO (Rem Collier): Really the token is now only used to retrieve the line number on which the syntax error occurred. A possible change to this class is to store only the line number, and not the full token.

See Also:
Serialized Form

Constructor Summary
SemanticError(java.lang.String error, java.lang.String cause, Token token)
          Creates a new Syntax Error.
 
Method Summary
 java.lang.String getMessage()
          Accessor that returns the message in java error format.
 
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

SemanticError

public SemanticError(java.lang.String error,
                     java.lang.String cause,
                     Token token)
Creates a new Syntax Error.

Parameters:
error - the general class of error
cause - some context that provides information about the actual cause of the error
token - a token close to the error that can be used to report the location of the error.
Method Detail

getMessage

public java.lang.String getMessage()
Accessor that returns the message in java error format.

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