Documentation
¶
Overview ¶
Package errors defines the typed parser error used throughout the luascript front-end. Lua 5.4 has a small, focused set of failure modes, so the categories here are intentionally narrow.
Index ¶
Constants ¶
const ( // EndOfFileError represents a normal EOF reached while expecting more input. EndOfFileError // UnexpectedTokenError means a token did not match what the grammar expected. UnexpectedTokenError // UnexpectedEndError means an `end` keyword appeared with nothing to close // (used by the REPL to detect "still typing" vs. "real syntax error"). UnexpectedEndError // InvalidAssignmentError means the LHS of an `=` is not a valid var. InvalidAssignmentError // SyntaxError is the catch-all for grammatical mistakes. SyntaxError )
Enums for different kinds of syntax errors.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
Error represents a parser failure with a human-readable message and a machine-readable category.
func NewTypeParsingError ¶
NewTypeParsingError reports a literal that could not be converted to its declared numeric type (e.g. an integer literal too large for int64).
func (*Error) Error ¶
Error implements the error interface, returning the message verbatim. Having this here lets callers return *Error directly as an `error` while preserving the typed-introspection helpers (IsEOF etc.) for the REPL.
func (*Error) IsUnexpectedEmptyLine ¶
IsUnexpectedEmptyLine reports whether the error is an unmatched `end` arising from REPL input with no preceding statements.
func (*Error) IsUnexpectedEnd ¶
IsUnexpectedEnd reports whether the error is an unmatched `end`.
func (*Error) IsUnexpectedToken ¶
IsUnexpectedToken reports whether the error is the generic "unexpected token" category.