1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
mod ecmascript;
mod identifier;
mod lazy_k;
mod utils;

use crate::engine::Command;
use crate::expr::Expr;
use anyhow::Result;
pub use ecmascript::parse_command as parse_command_with_ecmascript_style;
pub use ecmascript::parse_expr as parse_expr_with_ecmascript_style;
pub use ecmascript::parse_update_or_delete as parse_update_or_delete_with_ecmascript_style;
pub use lazy_k::parse_command as parse_command_with_lazy_k_style;
pub use lazy_k::parse_expr as parse_expr_with_lazy_k_style;
pub use lazy_k::parse_update_or_delete as parse_update_or_delete_with_lazy_k_style;

pub fn parse_expr(input: &str) -> Result<Expr> {
    parse_expr_with_ecmascript_style(input).or_else(|_err| parse_expr_with_lazy_k_style(input))
}

pub fn parse_command(input: &str) -> Result<Command> {
    parse_command_with_ecmascript_style(input)
        .or_else(|_err| parse_command_with_lazy_k_style(input))
}

pub fn parse_update_or_delete(input: &str) -> Result<Command> {
    parse_update_or_delete_with_ecmascript_style(input)
        .or_else(|_err| parse_update_or_delete_with_lazy_k_style(input))
}