pub mod grammar;
pub mod query_file;
pub mod schema;
#[cfg(test)]
mod tests;
use crate::ast::*;
use crate::error::{QailError, QailResult};
const MAX_INPUT_LENGTH: usize = 64 * 1024;
pub fn parse(input: &str) -> QailResult<Qail> {
let input = input.trim();
if input.len() > MAX_INPUT_LENGTH {
return Err(QailError::parse(
0,
format!(
"Input too large: {} bytes (max {} bytes)",
input.len(),
MAX_INPUT_LENGTH,
),
));
}
match grammar::parse(input) {
Ok(cmd) => Ok(cmd),
Err(e) => Err(QailError::parse(0, e)),
}
}