protospec-build 0.3.0

One binary format language to rule them all, One binary format language to find them, One binary format language to bring them all and in the darkness bind them.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::*;

pub fn parse_or_expression(t: &mut TokenIter) -> ParseResult<Expression> {
    let mut expr = parse_and_expression(t)?;
    while t.eat(Token::Or).is_some() {
        let right = parse_and_expression(t)?;
        expr = Expression::Binary(BinaryExpression {
            span: *expr.span() + *right.span(),
            op: BinaryOp::Or,
            left: Box::new(expr),
            right: Box::new(right),
        })
    }
    Ok(expr)
}