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§
- Qala
Error - every way the compiler can reject a program, with the source span of the
fault.
PartialEqso tests can compare errors directly; noEqand noserdederives, because the parse variants carryTokenKind, which holds anf64and is therefore neitherEqnor (currently)serde-derivable. the diagnostics layer (Phase 3) builds its own structured editor form fromspan()andmessage()rather than serializing this enum directly.
Functions§
- display_
kind - the human spelling of a token kind, for error messages:
)notRParen,end of inputforTokenKind::Eof, a category name for the payload-carrying kinds (an identifier,an integer literal).