diff --git a/src/parse.rs b/src/parse.rs index 62818e2fb8..aa91482d83 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -404,10 +404,12 @@ where I: Stream, I::Error: ParseError { choice(( + string("&&").map(|_| Operator::And), attempt(string("==")).map(|_| Operator::Equals), attempt(string("<=")).map(|_| Operator::LessThanOrEq), attempt(string(">=")).map(|_| Operator::GreaterThanOrEq), attempt(string("|>")).map(|_| Operator::Pizza), + string("||").map(|_| Operator::Or), char('+').map(|_| Operator::Plus), char('-').map(|_| Operator::Minus), char('*').map(|_| Operator::Star), diff --git a/tests/test_parse.rs b/tests/test_parse.rs index 37f9f0d6a7..960aedcd25 100644 --- a/tests/test_parse.rs +++ b/tests/test_parse.rs @@ -1392,4 +1392,23 @@ mod test_parse { "")) ); } + + #[test] + fn compare_and() { + assert_eq!( + parse_with_precedence("x > 1 || True"), + Ok((Operator( + loc_box( + Operator( + loc_box(Var("x".to_string())), + loc(GreaterThan), + loc_box(Int(1)) + ) + ), + loc(Or), + loc_box(ApplyVariant("True".to_string(), None)) + ), + "")) + ); + } }