return an error when the parser is at its event capacity
This commit is contained in:
parent
26d3b8ed8a
commit
337de0b57b
2 changed files with 16 additions and 1 deletions
|
@ -220,6 +220,7 @@ enum StatusCode {
|
|||
SourceCodeTooLong,
|
||||
TooManyTokens,
|
||||
TooManyAstNodes,
|
||||
TooManyParserEvents,
|
||||
ParserUnbalancedEvents,
|
||||
ChunkTooBig,
|
||||
DiagnosticsEmitted,
|
||||
|
@ -254,6 +255,7 @@ extern "C" fn haku_status_string(code: StatusCode) -> *const i8 {
|
|||
StatusCode::SourceCodeTooLong => c"source code is too long",
|
||||
StatusCode::TooManyTokens => c"source code has too many tokens",
|
||||
StatusCode::TooManyAstNodes => c"source code has too many AST nodes",
|
||||
StatusCode::TooManyParserEvents => c"source code has too many parser events",
|
||||
StatusCode::ParserUnbalancedEvents => c"parser produced unbalanced events",
|
||||
StatusCode::ChunkTooBig => c"compiled bytecode is too large",
|
||||
StatusCode::DiagnosticsEmitted => c"diagnostics were emitted",
|
||||
|
@ -365,6 +367,10 @@ unsafe extern "C" fn haku_compile_brush(
|
|||
info!("compiling failed: too many AST nodes");
|
||||
return StatusCode::TooManyAstNodes;
|
||||
}
|
||||
Err(IntoAstError::TooManyEvents) => {
|
||||
info!("compiling failed: too many parser events");
|
||||
return StatusCode::TooManyParserEvents;
|
||||
}
|
||||
Err(IntoAstError::UnbalancedEvents) => {
|
||||
info!("compiling failed: parser produced unbalanced events");
|
||||
return StatusCode::ParserUnbalancedEvents;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue