Package errors
Class Error
- java.lang.Object
-
- errors.Error
-
- Direct Known Subclasses:
LexicalError,SemanticError,SyntaxError
public abstract class Error extends java.lang.ObjectThe Error class is an abstract class used to represent errors that occur during compilation.Children classes of Error call the parent constructor when initialised, and the majority of object generation is performed here, which stores information about the error that occurred.
- Since:
- 1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classError.ErrorMessageThe ErrorMessage class is used to store information about an error.
-
Constructor Summary
Constructors Constructor Description Error(ErrorType errorType, SourceSpan span, java.lang.String problem, java.lang.String solution)Constructs an Error object for storing information about an error that occurred during compilation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Error.ErrorMessagegetErrorMessage(SourceInput sourceInput)Returns an ErrorMessage object, containing formatted information about the error that occurred.
-
-
-
Constructor Detail
-
Error
public Error(ErrorType errorType, SourceSpan span, java.lang.String problem, java.lang.String solution)
Constructs an Error object for storing information about an error that occurred during compilation.To generate an Error, it is required to provide a description of the problem and a solution. These must be clear, detailed, and jargon-free. The type of error and location in the text must also be provided.
- Parameters:
errorType- The type of error, which is based on where in the compilation process it occurredspan- The location in the text that the error occurredproblem- A description of the problem which caused the errorsolution- A description of a possible solution to solve the error
-
-
Method Detail
-
getErrorMessage
public Error.ErrorMessage getErrorMessage(SourceInput sourceInput)
Returns an ErrorMessage object, containing formatted information about the error that occurred.The same SourceInput object used during compilation is required in order to identify and visualised where in the text the error occurred.
- Parameters:
sourceInput- The original SourceInput used during compilation- Returns:
- An ErrorMessage object containing information about the error
-
-