expr_parser/expression.rs
1use crate::Span;
2
3#[derive(Clone, Copy, Debug, Eq)]
4pub struct Expression<Idx, B, U, T> {
5 pub kind: ExpressionKind<B, U, T>,
6 pub span: Span<Idx>,
7}
8
9/// Expression equality ignores the span
10impl<Idx, B: PartialEq, U: PartialEq, T: PartialEq> PartialEq for Expression<Idx, B, U, T> {
11 fn eq(&self, other: &Self) -> bool {
12 self.kind == other.kind
13 }
14}
15
16#[derive(Clone, Copy, Debug, Eq, PartialEq)]
17pub enum ExpressionKind<B, U, T> {
18 BinaryOperator(B),
19 UnaryOperator(U),
20 Term(T),
21}