marf.nlp.Parsing
Class SemanticError

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by marf.util.MARFException
              extended by marf.nlp.NLPException
                  extended by marf.nlp.Parsing.CompilerError
                      extended by marf.nlp.Parsing.SemanticError
All Implemented Interfaces:
java.io.Serializable, IMARFException

public class SemanticError
extends CompilerError

Class SemanticError Represents an instance of a semantic error in the semantic analysis process.

$Id: SemanticError.java,v 1.16 2007/12/18 21:37:55 mokhov Exp $

Since:
0.3.0.2
Version:
$Revision: 1.16 $
Author:
Serguei Mokhov
See Also:
Serialized Form

Field Summary
static int ERR_ASSIGN_TYPE_MISMATCH
          Type mismatch in the assignment.
static int ERR_CUSTOM
          Custom error message as alternative to 'unknown'.
static int ERR_EXPR_TYPE_MISMATCH
          Type mismatch in an expression.
static int ERR_MULT_DEF_SYM
          Symbol defined multiple times.
static int ERR_PARAM_TYPE_MISMATCH
          Mismatch of types of parameters in a function call.
static int ERR_UNDEF_SYM
          Undefined Symbol.
protected  Token oFaultingToken
          Token information at which Lexer encountered the error.
 
Fields inherited from class marf.nlp.Parsing.CompilerError
iCurrentErrorCode, iLineNo, OK
 
Fields inherited from class marf.util.MARFException
strMessage
 
Constructor Summary
SemanticError()
          Default constructor.
SemanticError(java.lang.Exception poException)
          Wraps an exception.
SemanticError(int piErrorCode, Token poFaultingToken)
          Constructor with an error code and a faulting token.
SemanticError(java.lang.String pstrMessage)
          Construct just given the error message
SemanticError(java.lang.String pstrMessage, java.lang.Exception poException)
          Wraps an exception with a custom error message
SemanticError(Token poFaultingToken, java.lang.String pstrCustomErrorMessage)
          Constructor alternative to Unknown error with the custom error message.
 
Method Summary
static java.lang.String getMARFSourceCodeRevision()
          Returns source code revision information.
 boolean serialize(int piOperation, java.io.FileWriter poFileWriter)
          Serialization routine.
 
Methods inherited from class marf.nlp.Parsing.CompilerError
getCurrentErrorCode, getLineNo
 
Methods inherited from class marf.util.MARFException
create, create, create, create, getMessage, toString
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ERR_UNDEF_SYM

public static final int ERR_UNDEF_SYM
Undefined Symbol.

Since:
December 19, 2001
See Also:
Constant Field Values

ERR_MULT_DEF_SYM

public static final int ERR_MULT_DEF_SYM
Symbol defined multiple times.

Since:
December 19, 2001
See Also:
Constant Field Values

ERR_EXPR_TYPE_MISMATCH

public static final int ERR_EXPR_TYPE_MISMATCH
Type mismatch in an expression.

Since:
December 19, 2001
See Also:
Constant Field Values

ERR_ASSIGN_TYPE_MISMATCH

public static final int ERR_ASSIGN_TYPE_MISMATCH
Type mismatch in the assignment.

Since:
December 19, 2001
See Also:
Constant Field Values

ERR_PARAM_TYPE_MISMATCH

public static final int ERR_PARAM_TYPE_MISMATCH
Mismatch of types of parameters in a function call.

Since:
December 19, 2001
See Also:
Constant Field Values

ERR_CUSTOM

public static final int ERR_CUSTOM
Custom error message as alternative to 'unknown'.

Since:
December 19, 2001
See Also:
Constant Field Values

oFaultingToken

protected Token oFaultingToken
Token information at which Lexer encountered the error.

Since:
October 2, 2001
Constructor Detail

SemanticError

public SemanticError(int piErrorCode,
                     Token poFaultingToken)
Constructor with an error code and a faulting token.

Parameters:
piErrorCode - one of the defined error codes
poFaultingToken - the semantic token that caused the error.

SemanticError

public SemanticError(Token poFaultingToken,
                     java.lang.String pstrCustomErrorMessage)
Constructor alternative to Unknown error with the custom error message.

Parameters:
poFaultingToken - the semantic token that caused the error.
pstrCustomErrorMessage - custom error message

SemanticError

public SemanticError()
Default constructor.

Since:
0.3.0.5

SemanticError

public SemanticError(java.lang.Exception poException)
Wraps an exception.

Parameters:
poException - exception to wrap
Since:
0.3.0.5

SemanticError

public SemanticError(java.lang.String pstrMessage)
Construct just given the error message

Parameters:
pstrMessage - custom error message
Since:
0.3.0.5

SemanticError

public SemanticError(java.lang.String pstrMessage,
                     java.lang.Exception poException)
Wraps an exception with a custom error message

Parameters:
pstrMessage - custom error message
poException - exception to wrap
Since:
0.3.0.5
Method Detail

serialize

public boolean serialize(int piOperation,
                         java.io.FileWriter poFileWriter)
Serialization routine. TODO: migrate to MARF's dump/restore mechanism

Parameters:
piOperation - 0 means load (not implemented) and 1 means save
poFileWriter - writer object to write the error message to
Returns:
true if the operation was successful

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Returns source code revision information.

Returns:
revision string


SourceForge Logo