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