diff --git a/parser/src/ast/expr.rs b/parser/src/ast/expr.rs index bee7250..d5f6d39 100644 --- a/parser/src/ast/expr.rs +++ b/parser/src/ast/expr.rs @@ -17,12 +17,19 @@ pub enum BinaryOp { GreaterThanOrEqual, And, Or, + ShiftLeft, + ShiftRight, + RangeInclusive, + RangeExclusive, + BitAnd, + BitOr, + BitXor, } #[derive(Debug, Clone, Serialize)] pub enum Expression { Literal(Literal), - Path(Path), + Path(ExprPath), // Updated from Path to support paths containing turbofish segments Fix { initial: Box, prefixes: Vec, @@ -42,6 +49,8 @@ pub enum Literal { Float(f64), Bool(bool), Tuple(Vec), + Array(Vec), + ArrayRepeat(Box, Box), } #[derive(Debug, Clone, Serialize)] @@ -56,11 +65,14 @@ pub enum Pattern { #[derive(Debug, Clone, Serialize)] pub enum Postfix { - FieldAccess(Identifier), + FieldAccess(Identifier, Option), // Updated to support method turbofish chains Call(Vec), MacroCall(String), StructCall(Vec<(Identifier, Expression)>), Index(Expression), + As(TypeExpr), + RangeInclusive, + RangeExclusive, } #[derive(Debug, Clone, Serialize)] @@ -70,4 +82,18 @@ pub enum Prefix { Deref, New, Not, + Neg, + RangeInclusive, + RangeExclusive, +} + +#[derive(Debug, Clone, Serialize)] +pub struct ExprPathSegment { + pub ident: Identifier, + pub generics: Option, +} + +#[derive(Debug, Clone, Serialize)] +pub struct ExprPath { + pub segments: Vec, }