- All Implemented Interfaces:
Serializable
ScriptParser encounters a syntax error in a
.relix source file.
The exception message is the human-readable description of the problem
followed by its source location, stated once as (line N, col M) — the
message is often shown on its own, and without the position it does not say
where the error is. Use ScriptParseException.line() and ScriptParseException.column() (inherited from
ScriptParseException) for programmatic access to the same position;
suffix(int, int) is the exact text appended, for a caller that already
reports the position and wants the message without it.
This is the .relix text grammar's specialisation of the core-level
ScriptParseException — the type the engine's "where does a
Script come from" seam declares. Callers that do not care
which frontend failed should catch the supertype.
It is a RuntimeException so that the parser API does not require
checked-exception handling at every call site.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLangParseException(String message, int line, int column) Constructs a parse exception with a descriptive message.LangParseException(String message, LangToken token) Constructs a parse exception from the offending token. -
Method Summary
Modifier and TypeMethodDescriptionReturns the message without thesuffix(int, int)it ends with.static Stringsuffix(int line, int column) Returns the position text the message ends with," (line N, col M)".Methods inherited from class com.darkcollective.relix.lang.ast.ScriptParseException
column, lineMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
LangParseException
Constructs a parse exception with a descriptive message.- Parameters:
message- a human-readable description of the problemline- 1-based source line of the offending tokencolumn- 1-based source column of the offending token
-
LangParseException
Constructs a parse exception from the offending token.- Parameters:
message- human-readable problem descriptiontoken- the token at which parsing failed
-
-
Method Details
-
suffix
Returns the position text the message ends with," (line N, col M)".- Parameters:
line- 1-based source linecolumn- 1-based source column- Returns:
- the suffix a message at that position carries
-
description
Returns the message without thesuffix(int, int)it ends with.- Overrides:
descriptionin classScriptParseException- Returns:
- the description of the problem, without its position
-