1pub mod grammar;
16pub mod query_file;
17pub mod schema;
18
19#[cfg(test)]
20mod tests;
21
22use crate::ast::*;
23use crate::error::{QailError, QailResult};
24
25pub fn parse(input: &str) -> QailResult<Qail> {
28 let input = input.trim();
29
30 match grammar::parse_root(input) {
31 Ok(("", cmd)) => Ok(cmd),
32 Ok((remaining, _)) => Err(QailError::parse(
33 input.len() - remaining.len(),
34 format!("Unexpected trailing content: '{}'", remaining),
35 )),
36 Err(e) => Err(QailError::parse(0, format!("Parse failed: {:?}", e))),
37 }
38}