Crates.io | eles |
lib.rs | eles |
version | 1.0.0 |
source | src |
created_at | 2022-04-24 00:23:34.220864 |
updated_at | 2022-04-24 00:23:34.220864 |
description | ELES; Extensible Logical Expression Solver |
homepage | |
repository | https://github.com/usagi/eles |
max_upload_size | |
id | 572876 |
size | 24,506 |
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.
// 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: