marf.nlp.Parsing
Class LexicalError

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.LexicalError
All Implemented Interfaces:
java.io.Serializable, IMARFException

public class LexicalError
extends CompilerError

This class denotes a lexical error type.

$Id: LexicalError.java,v 1.20 2008/01/03 03:21:57 mokhov Exp $

Since:
0.3.0.2 (in MARF)
Version:
$Revision: 1.20 $
Author:
Serguei Mokhov
See Also:
Serialized Form

Field Summary
static int ERR_BAD_REAL
          Badly formed real number.
static int ERR_CUSTOM
          Custom error message as alternative to 'unknown'.
static int ERR_EXTRA_CLOSING_COMMENT
          Mismatched comment.
static int ERR_INVALID_CHAR
          Character encountered is not part of the MARF's alphabet.
static int ERR_INVALID_NUMBER_FORMAT
          Invalid number format.
static int ERR_LEADING_ZEROS
          Leading zeros are not allowed in numbers.
static int ERR_TRAILING_ZEROS
          Not meaningful trailing zeros aren't allowed.
static int ERR_UNEXPECTED_EOF
          Unexpected EOF and no ending comment.
private static java.lang.String[] LEXICAL_ERROR_MESSAGES
          Standard set of lexical error messages.
protected  Token oFaultingToken
          Token information at which Lexer encountered the error.
private static long serialVersionUID
          For serialization versioning.
 
Fields inherited from class marf.nlp.Parsing.CompilerError
iCurrentErrorCode, iLineNo, OK
 
Fields inherited from class marf.util.MARFException
strMessage
 
Constructor Summary
LexicalError()
          Constructs default generic lexical error.
LexicalError(java.lang.Exception poException)
          Constructs a lexical error with wrapped exception.
LexicalError(int piErrorCode, Token poFaultingToken)
          Constructor with an error code and a faulting token.
LexicalError(java.lang.String pstrMessage)
          Constructs a lexical error with a custom error message string.
LexicalError(java.lang.String pstrMessage, java.lang.Exception poException)
          Constructs a lexical error with wrapped exception and a custom error message string.
LexicalError(Token poFaultingToken, java.lang.String pstrCustomErrorMessage)
          Constructor alternative to Unknown error given token and a custom message.
 
Method Summary
static java.lang.String getMARFSourceCodeRevision()
          Retrieves class' revision.
 boolean serialize(int piOperation, java.io.FileWriter poWriter)
          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_INVALID_CHAR

public static final int ERR_INVALID_CHAR
Character encountered is not part of the MARF's alphabet.

Since:
October 2, 2001
See Also:
Constant Field Values

ERR_LEADING_ZEROS

public static final int ERR_LEADING_ZEROS
Leading zeros are not allowed in numbers.

Since:
October 2, 2001
See Also:
Constant Field Values

ERR_TRAILING_ZEROS

public static final int ERR_TRAILING_ZEROS
Not meaningful trailing zeros aren't allowed.

Since:
October 2, 2001
See Also:
Constant Field Values

ERR_BAD_REAL

public static final int ERR_BAD_REAL
Badly formed real number.

Since:
October 2, 2001
See Also:
Constant Field Values

ERR_INVALID_NUMBER_FORMAT

public static final int ERR_INVALID_NUMBER_FORMAT
Invalid number format.

Since:
October 2, 2001
See Also:
Constant Field Values

ERR_UNEXPECTED_EOF

public static final int ERR_UNEXPECTED_EOF
Unexpected EOF and no ending comment.

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

ERR_EXTRA_CLOSING_COMMENT

public static final int ERR_EXTRA_CLOSING_COMMENT
Mismatched comment.

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

ERR_CUSTOM

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

Since:
October 2, 2001
See Also:
Constant Field Values

LEXICAL_ERROR_MESSAGES

private static final java.lang.String[] LEXICAL_ERROR_MESSAGES
Standard set of lexical error messages. Must correspond to the ERR_ indexes above.

Since:
October 2, 2001

oFaultingToken

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

Since:
October 2, 2001

serialVersionUID

private static final long serialVersionUID
For serialization versioning. When adding new members or make other structural changes regenerate this number with the serialver tool that comes with JDK.

Since:
0.3.0.4
See Also:
Constant Field Values
Constructor Detail

LexicalError

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

Parameters:
piErrorCode - the error code to indicate the message
poFaultingToken - the token that caused the error

LexicalError

public LexicalError(Token poFaultingToken,
                    java.lang.String pstrCustomErrorMessage)
Constructor alternative to Unknown error given token and a custom message.

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

LexicalError

public LexicalError()
Constructs default generic lexical error.

Since:
0.3.0.5

LexicalError

public LexicalError(java.lang.Exception poException)
Constructs a lexical error with wrapped exception.

Parameters:
poException - the wrapped exception
Since:
0.3.0.5

LexicalError

public LexicalError(java.lang.String pstrMessage)
Constructs a lexical error with a custom error message string.

Parameters:
pstrMessage - the custom error message
Since:
0.3.0.5

LexicalError

public LexicalError(java.lang.String pstrMessage,
                    java.lang.Exception poException)
Constructs a lexical error with wrapped exception and a custom error message string.

Parameters:
pstrMessage - the custom error message
poException - the wrapped exception
Since:
0.3.0.5
Method Detail

serialize

public boolean serialize(int piOperation,
                         java.io.FileWriter poWriter)
Serialization routine. Loading is not implemented.

Parameters:
piOperation - 0 for load and 1 for save
poWriter - writer object to use to write to
Returns:
true if serialization was successful

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Retrieves class' revision.

Returns:
revision string


SourceForge Logo