edu.cornell.cs.cs4120.xi
Class CompilationException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by edu.cornell.cs.cs4120.xi.CompilationException
All Implemented Interfaces:
Serializable

public class CompilationException
extends RuntimeException

An exception indicating an invalid Xi program.

See Also:
Serialized Form

Constructor Summary
CompilationException(Position position)
          Constructs a generic compilation exception indicating offending code at the given position.
CompilationException(String message, Position position)
          Constructs a compilation exception indicating offending code at the given position with the given message as a reason.
 
Method Summary
 Position getPosition()
          Returns the position in the offending Xi code.
 String toString()
          Returns a human-friendly representation of this exception, including the compilation unit (if available), the line number, and the error message.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompilationException

public CompilationException(Position position)
Constructs a generic compilation exception indicating offending code at the given position.

Parameters:
position - the position of the code causing this compilation exception

CompilationException

public CompilationException(String message,
                            Position position)
Constructs a compilation exception indicating offending code at the given position with the given message as a reason.

Parameters:
message - the reason for this compilation exception
position - the position of the code causing this compilation exception
Method Detail

getPosition

public final Position getPosition()
Returns the position in the offending Xi code.

Returns:
the position of the offending Xi code

toString

public String toString()
Returns a human-friendly representation of this exception, including the compilation unit (if available), the line number, and the error message.

Overrides:
toString in class Throwable
Returns:
a human-friendly representation of this compilation exception