Class ScriptParseException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.darkcollective.relix.lang.ast.ScriptParseException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
LangParseException

public class ScriptParseException extends RuntimeException
Thrown when a frontend cannot turn its input into a Script.

The engine's front door is the AST: a Script is the currency, and how one is produced — the .relix text grammar, a serialized query format, a programmatic builder — is a frontend concern the core does not name. This exception is the core-level counterpart: the seam types that ask a frontend for a Script (notably ScriptLoader.load) declare this type, and each frontend throws a subtype carrying its own diagnostic detail.

This is a RuntimeException so that producing an AST does not force checked-exception handling at every call site.

The message is used verbatim — subclasses that decorate it with position information (as the .relix grammar's exception does) must do so themselves before calling super.

See Also:
  • Constructor Details

    • ScriptParseException

      public ScriptParseException(String message)
      Constructs an exception with no known source position.
      Parameters:
      message - a human-readable description of the problem
    • ScriptParseException

      public ScriptParseException(String message, int line, int column)
      Constructs an exception at a known source position.
      Parameters:
      message - a human-readable description of the problem
      line - 1-based source line, or 0 when the position is unknown
      column - 1-based source column, or 0 when the position is unknown
  • Method Details

    • line

      public final int line()
      Returns the 1-based source line the failure occurred at, or 0 when the producing frontend has no line/column notion (a builder API) or could not attribute one.
      Returns:
      the 1-based line, or 0 if unknown
    • column

      public final int column()
      Returns the 1-based source column the failure occurred at, or 0 when unknown; see line().
      Returns:
      the 1-based column, or 0 if unknown
    • description

      public String description()
      Returns the description of the problem without any position a subclass appended to the message.

      A caller that reports the position itself — beside a file name, say — would otherwise state it twice. The default is the message verbatim, which is right for a frontend that decorates nothing.

      Returns:
      the message without its position text; never null