Skip to main content

Module parse_error

Module parse_error 

Source
Expand description

Typed parser-error catalogue.

Mirrors the diagnostic strings emitted by LLParser::error / LLParser::tokError in llvm/lib/AsmParser/LLParser.cpp. Upstream uses free-form Twine strings; we keep the same wording for the subset we ship today but route every variant through structured fields so callers can match on the failure mode without string comparison.

The catalogue is intentionally narrow in this session — only the variants that the substrate (lexer pass-through, slot-table integrity, forward-reference resolution, location registry) and the immediate follow-on parser sessions will populate. Sessions 2-3 grow the enum as they add real parse* arms; the variants ship now so the parser does not have to relitigate the public error shape later.

Structs§

DiagLoc
Where in the source a diagnostic points. Carrying both the byte Span (set by every parser arm) and the optional FileLocRange projection (populated when the parser is configured to track line/col) keeps low-level tooling and human-facing renderers happy without a second walk over the source buffer.

Enums§

ParseError
Top-level parser error.
SymbolId
Symbol identity: either an explicit name (@foo, %bar) or a slot number (%0, @5).
SymbolKind
Top-level entity kind — distinguishes the namespaces tracked by the parser when it reports symbol errors. Mirrors the four ForwardRefVals / ForwardRefBlocks / ForwardRefMDNodes / NumberedTypes tables in LLParser.

Type Aliases§

ParseResult
Result alias parameterised on ParseError.