net.sourceforge.nrl.parser
Class NRLError

java.lang.Object
  extended by net.sourceforge.nrl.parser.NRLError
Direct Known Subclasses:
SemanticError, SyntaxError

public abstract class NRLError
extends Object

An abstract error that contains line, column and character index info, as well as a status code.

This acts as a superclass for SyntaxError and SemanticError.

Note that lines are numbered from 1 and columns from 0. If you require a full character offset for anything, use StringUtilities.getCharacterPosition(String, int, int).


Constructor Summary
NRLError(int statusCode, int line, int column, int length, String message)
           
 
Method Summary
 int getColumn()
          Return the column where the error occurred, or -1 if not available.
 int getLength()
          Return the length of the input text connected to the error, or 0 if not available.
 int getLine()
          Return the line where the error occurred.
 String getMessage()
          Return the error message
 int getStatusCode()
          Return the status code, one of the constants in the IStatusCode class.
 void setColumn(int column)
          Set the column where the error occurred.
 void setLength(int length)
          Set the length of the error
 void setLine(int line)
          Set the line where the error occurred
 void setMessage(String message)
          Set the error message
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NRLError

public NRLError(int statusCode,
                int line,
                int column,
                int length,
                String message)
Method Detail

getColumn

public int getColumn()
Return the column where the error occurred, or -1 if not available.

Returns:
the column or -1

getLength

public int getLength()
Return the length of the input text connected to the error, or 0 if not available.

Returns:
the length

getLine

public int getLine()
Return the line where the error occurred. This is 1-based.

Returns:
the line

getMessage

public String getMessage()
Return the error message

Returns:
the message

getStatusCode

public int getStatusCode()
Return the status code, one of the constants in the IStatusCode class.

Returns:
the status code

setColumn

public void setColumn(int column)
Set the column where the error occurred. 0 based.

Parameters:
column - the column

setLength

public void setLength(int length)
Set the length of the error

Parameters:
length - the length

setLine

public void setLine(int line)
Set the line where the error occurred

Parameters:
line - the line

setMessage

public void setMessage(String message)
Set the error message

Parameters:
message - the message


Copyright © 2006-2010 Christian Nentwich and others