Predicator.Errors.ParseError (predicator v4.0.0)

Copy Markdown View Source

Error struct for parse errors in Predicator expressions.

This error occurs when the input expression cannot be parsed due to syntax errors.

Fields

  • message - Human-readable error description
  • position - {line, column} of the syntax error, typed Predicator.Types.position/0 so generic error-reporting code can read a position uniformly across ParseError, EvaluationError, TypeMismatchError, and UndefinedVariableError

Examples

%Predicator.Errors.ParseError{
  message: "Expected number, string, boolean, date, datetime, identifier, function call, list, or '(' but found '>' at line 1, column 10",
  position: {1, 10}
}

Summary

Functions

Creates a parse error.

Types

t()

@type t() :: %Predicator.Errors.ParseError{
  message: binary(),
  position: Predicator.Types.position()
}

Functions

new(message, line, column)

@spec new(binary(), pos_integer(), pos_integer()) :: t()

Creates a parse error.

Takes the line and column separately because that is the shape Predicator.Lexer.tokenize/1 and Predicator.Parser.parse/2 report failures in; the struct stores them as a single :position tuple.