Skip to main content

Module errors

Module errors 

Source
Expand description

the compiler’s error type. one enum, QalaError, returned everywhere as Result<T, QalaError>. every variant carries a Span so a diagnostic can point at the exact source text; rich rendering (the source line plus an underline) is built in a later phase on top of that span.

the lexer’s and the parser’s variants exist now. type-checker and runtime variants follow the same { span, message } shape and are sketched in comments below so later phases extend this enum rather than restructure it.

Enums§

QalaError
every way the compiler can reject a program, with the source span of the fault. PartialEq so tests can compare errors directly; no Eq and no serde derives, because the parse variants carry TokenKind, which holds an f64 and is therefore neither Eq nor (currently) serde-derivable. the diagnostics layer (Phase 3) builds its own structured editor form from span() and message() rather than serializing this enum directly.

Functions§

display_kind
the human spelling of a token kind, for error messages: ) not RParen, end of input for TokenKind::Eof, a category name for the payload-carrying kinds (an identifier, an integer literal).