Finalize the parser in the case of Error while running queries. This resets the parser stack and prevents triggering the assertion and thereby panic.

Closes https://github.com/tursodatabase/limbo/issues/742
This commit is contained in:
Krishna Vishal
2025-01-20 16:10:35 +05:30
parent 9369f06699
commit 04fd5a40d6
2 changed files with 10 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ pub use error::Error;
pub struct Parser<'input> {
input: &'input [u8],
scanner: Scanner<Tokenizer>,
/// lemon parser
parser: yyParser<'input>,
}
@@ -62,6 +63,11 @@ impl<'input> Parser<'input> {
pub fn offset(&self) -> usize {
self.scanner.offset()
}
/// Public API for sqlite3ParserFinalize()
pub fn finalize(&mut self) {
self.parser.sqlite3ParserFinalize();
}
}
/*