Skip to main content

Module spanned

Module spanned 

Source
Expand description

Located, error-recovering parsers for .text streams and header declarations.

parse_text and parse_declarations accept exactly the inputs that ParsedModule::parse_section and HeaderDeclarations accept, but keep the byte span of every instruction, symbol definition, and declaration, and keep going after a malformed statement so that every problem is reported as a human-readable SyntaxError.

Both split their block into statements first (see statements): one statement per line, continued onto following lines only inside an open bracket. Each statement is parsed on its own, so recovery is per line and every bad line is reported once. Spans are byte ranges relative to the parsed block.

Structs§

ParsedDeclarations
Located header declarations and every syntax error.
ParsedText
A located .text stream: instructions in address order, symbol definitions in source order, and every syntax error.
Spanned
A parsed value and the byte range of its source text.
SyntaxError
A located, human-readable syntax error.

Functions§

line_column
The 1-based line and column (counted in characters) of offset in text.
parse_declarations
Parse header declarations, one per statement, keeping spans and recovering after malformed declarations.
parse_declarations_at
parse_declarations for a block that starts on file line first_line.
parse_text
Parse a .text stream, keeping spans and recovering after malformed statements.
parse_text_at
parse_text for a block that starts on file line first_line.