Parser refactoring to use new (Maybe)ParseResult types, WIP.

This commit is contained in:
Jesse Brault 2026-08-21 13:18:20 -05:00
parent 56196551b8
commit 6ac075ffd0
2 changed files with 488 additions and 446 deletions

View File

@ -105,12 +105,14 @@ fn compile_statement(
register_count: usize, register_count: usize,
constants_table: &mut ConstantsTable, constants_table: &mut ConstantsTable,
) -> Result<Function, Diagnostics> { ) -> Result<Function, Diagnostics> {
let (maybe_statement, parse_diagnostics) = parse_statement(input); let maybe_statement = parse_statement(input);
if !parse_diagnostics.is_empty() { if !maybe_statement.is_ok() {
Err(parse_diagnostics) Err(maybe_statement.into_diagnostics())
} else if let Some(statement) = maybe_statement {
session.compile_statement(&statement, register_count, constants_table)
} else { } else {
panic!("Unable to unwrap statement from previous input.") session.compile_statement(
&maybe_statement.into_inner(),
register_count,
constants_table,
)
} }
} }

File diff suppressed because it is too large Load Diff