add xor operator
This commit is contained in:
parent
71774b2a2c
commit
4d03535741
|
@ -63,6 +63,7 @@ pub struct Assign<'a> {
|
||||||
pub enum Operation<'a> {
|
pub enum Operation<'a> {
|
||||||
And { a: Expression<'a>, b: Expression<'a> },
|
And { a: Expression<'a>, b: Expression<'a> },
|
||||||
Or { a: Expression<'a>, b: Expression<'a> },
|
Or { a: Expression<'a>, b: Expression<'a> },
|
||||||
|
Xor { a: Expression<'a>, b: Expression<'a> },
|
||||||
Not(Expression<'a>),
|
Not(Expression<'a>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +114,13 @@ fn operation(input: Span) -> IResult<Span, Operation> {
|
||||||
b,
|
b,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
map(
|
||||||
|
separated_pair(ws0(expression_nonrecurse), char('^'), ws0(expression)),
|
||||||
|
|(a, b)| Operation::Xor {
|
||||||
|
a,
|
||||||
|
b,
|
||||||
|
},
|
||||||
|
),
|
||||||
map(
|
map(
|
||||||
preceded(char('~'), expression),
|
preceded(char('~'), expression),
|
||||||
|expr| Operation::Not(expr),
|
|expr| Operation::Not(expr),
|
||||||
|
|
Loading…
Reference in New Issue