Skip to content

Commit e8e8058

Browse files
committed
Add unary operator parsing
1 parent e57bed0 commit e8e8058

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/filter.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ fn combining_op(input: &str) -> (Option<CombiningOp>, &str) {
3434

3535
impl<K: Borrow<str> + Hash + Eq, T: GetType> Context<K, T> {
3636
fn simple_filter<'i>(&self, input: &'i str) -> LexResult<'i, Filter<'i>> {
37+
if let Ok((op, input)) = UnaryOp::lex(input) {
38+
let input = input.trim_left();
39+
let (arg, input) = self.simple_filter(input)?;
40+
return Ok((Filter::Unary(op, Box::new(arg)), input.trim_left()));
41+
}
42+
3743
if let Ok(input) = expect(input, "(") {
3844
let input = input.trim_left();
3945
let (res, input) = self.combined_filter(input)?;

0 commit comments

Comments
 (0)