Enum bitsy_lang::ast::Expr
source · pub enum Expr {
Show 16 variants
Ident(Span, Ident),
Dot(Span, Box<Expr>, Ident),
Word(Span, Option<Width>, u64),
Enum(Span, Type, String),
Struct(Span, Vec<(String, Box<Expr>)>),
Vec(Span, Vec<Expr>),
Call(Span, Ident, Vec<TypeParam>, Vec<Expr>),
Let(Span, Ident, Option<Type>, Box<Expr>, Box<Expr>),
UnOp(Span, UnOp, Box<Expr>),
BinOp(Span, BinOp, Box<Expr>, Box<Expr>),
If(Span, Box<Expr>, Box<Expr>, Box<Expr>),
Match(Span, Box<Expr>, Vec<MatchArm>),
IdxField(Span, Box<Expr>, Ident),
Idx(Span, Box<Expr>, u64),
IdxRange(Span, Box<Expr>, u64, u64),
Hole(Span, Option<Ident>),
}
Expand description
An expression.
Variants§
Ident(Span, Ident)
A referenec to a port, reg, or node.
Dot(Span, Box<Expr>, Ident)
A dotted expression. Eg, foo.bar
.
Word(Span, Option<Width>, u64)
A literal Word.
Enum(Span, Type, String)
A literal enum value.
Struct(Span, Vec<(String, Box<Expr>)>)
A constructor for a struct type.
Vec(Span, Vec<Expr>)
A constructor for a Vec
Call(Span, Ident, Vec<TypeParam>, Vec<Expr>)
A call-like expression, including cat
and constructors like @Valid
.
Let(Span, Ident, Option<Type>, Box<Expr>, Box<Expr>)
Let binding. Eg, let x = a + b in x + x
.
UnOp(Span, UnOp, Box<Expr>)
A unary operation. Eg, !0b101w3
.
BinOp(Span, BinOp, Box<Expr>, Box<Expr>)
A binary operation. Eg, 1w8 + 1w8
.
If(Span, Box<Expr>, Box<Expr>, Box<Expr>)
An if
expression.
Match(Span, Box<Expr>, Vec<MatchArm>)
A match
expression.
IdxField(Span, Box<Expr>, Ident)
A field index. Eg, foo->bar
.
Idx(Span, Box<Expr>, u64)
A static index. Eg, foo[0]
.
IdxRange(Span, Box<Expr>, u64, u64)
A static index over a range. Eg, foo[8..4]
.
Hole(Span, Option<Ident>)
A hole. Eg, ?foo
.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more