Package errors
Class LexicalError
- java.lang.Object
-
- errors.Error
-
- errors.LexicalError
-
public final class LexicalError extends Error
The LexicalError class is used to represent an error that occurred during the lexical analysis stage of compilation.Static methods for generating LexicalErrors are stored here, each of which uses a set of pre-defined input Strings.
- Since:
- 1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class errors.Error
Error.ErrorMessage
-
-
Constructor Summary
Constructors Constructor Description LexicalError(SourceSpan span, java.lang.String problem, java.lang.String solution)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LexicalErrorbadCharacter(java.lang.String syntax, int start, int length)Generate and return a LexicalError for an invalid character.static LexicalErrorincompleteString(java.lang.String syntax, int start, int length)Generate and return a LexicalError for an incomplete string.static LexicalErrorinvalidDouble(java.lang.String syntax, int start, int length)Generate and return a LexicalError for an invalid double.static LexicalErrorinvalidInt(java.lang.String syntax, int start, int length)Generate and return a LexicalError for an invalid integer.-
Methods inherited from class errors.Error
getErrorMessage
-
-
-
-
Constructor Detail
-
LexicalError
public LexicalError(SourceSpan span, java.lang.String problem, java.lang.String solution)
-
-
Method Detail
-
invalidInt
public static LexicalError invalidInt(java.lang.String syntax, int start, int length)
Generate and return a LexicalError for an invalid integer.- Parameters:
syntax- The syntax of the integerstart- The start position of the syntaxlength- The length of the syntax- Returns:
- A LexicalError containing information about an error that occurred
-
invalidDouble
public static LexicalError invalidDouble(java.lang.String syntax, int start, int length)
Generate and return a LexicalError for an invalid double.- Parameters:
syntax- The syntax of the doublestart- The start position of the syntaxlength- The length of the syntax- Returns:
- A LexicalError containing information about an error that occurred
-
badCharacter
public static LexicalError badCharacter(java.lang.String syntax, int start, int length)
Generate and return a LexicalError for an invalid character.- Parameters:
syntax- The syntax of the characterstart- The start position of the syntaxlength- The length of the syntax- Returns:
- A LexicalError containing information about an error that occurred
-
incompleteString
public static LexicalError incompleteString(java.lang.String syntax, int start, int length)
Generate and return a LexicalError for an incomplete string.- Parameters:
syntax- The syntax of the stringstart- The start position of the syntaxlength- The length of the syntax- Returns:
- A LexicalError containing information about an error that occurred
-
-