1 stable release
1.0.0 | Apr 24, 2022 |
---|
#221 in Parser tooling
13KB
353 lines
ELES; Extensible Logical Expression Solver
If you have an existing parser that outputs a single boolean value and you want to add support for AND, OR, XOR, and parentheses, ELES can be of great help. For example, if you already have a system that interprets string syntax to determine/search data for a single item, and you want to support AND/OR searches for multiple items or complex conditions assembled using parentheses, ELES is the usefull library for you.
Example
// The simplest example
fn main()
{
let input = "true && (( false ^^ true && !! false )) || false";
let literal_parser = |literal: &str| Ok(literal.parse::<bool>().unwrap_or_default());
let r = eles::solve(&input, literal_parser);
println!("{:?}", r);
}
More examples are here:
And these tests might be usefull that study usage:
LICENSE
Author
- USAGI.NETWORK / Usagi Ito https://github.com/usagi/
Dependencies
~130KB