# filter-expr
A library for parsing the filter expression.
```rust
use filter_expr::{FilterExpr, SimpleContext};
let f = FilterExpr::parse("name = 'John' AND age > 18").unwrap();
let ctx = SimpleContext::new(HashMap::from([
("name".to_string(), "John".into()),
("age".to_string(), 19.into()),
]));
let result = f.eval(&ctx).await.unwrap();
assert_eq!(result, true);
```
## Syntax
### Filter
```
<empty> =
```
### Expression
```
<expr> = <factor> ('AND' <factor>)*
<factor> = <term> ('OR' <term>)*
<term> = ['NOT'] <comparison>
| <value> [<operator> <value>]
### Value
```
<value> = <str>
| <i64>
| <f64>
| <bool>
| <null>
| <func-call>
| <ident>
| <array>
<func-call> = <ident> '(' [<value> (',' <value>)* ','?] ')'
<array> = '[' [<value> (',' <value>)* ','?] ']'
```