From f34998d512e9b68dc6e969c9208c2ba811182022 Mon Sep 17 00:00:00 2001 From: gwenn Date: Sun, 4 Aug 2024 13:24:24 +0200 Subject: [PATCH] Fix sql_cmds example Continue parsing input file after an error only if YYNOERRORRECOVERY is disabled --- examples/sql_cmds.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/sql_cmds.rs b/examples/sql_cmds.rs index eab763a..e4da717 100644 --- a/examples/sql_cmds.rs +++ b/examples/sql_cmds.rs @@ -3,7 +3,9 @@ use std::env; use std::fs::read; use std::panic; -use sqlite3_parser::lexer::sql::{Error, Parser}; +#[cfg(not(feature = "YYNOERRORRECOVERY"))] +use sqlite3_parser::lexer::sql::Error; +use sqlite3_parser::lexer::sql::Parser; /// Parse specified files and print all commands. fn main() { @@ -19,6 +21,9 @@ fn main() { Ok(None) => break, Err(err) => { eprintln!("Err: {err} in {arg}"); + #[cfg(feature = "YYNOERRORRECOVERY")] + break; + #[cfg(not(feature = "YYNOERRORRECOVERY"))] if let Error::ParserError(..) = err { } else { break;