Enum gluon_base::ast::Expr [−][src]
pub enum Expr<Id> { Ident(TypedIdent<Id>), Literal(Literal), App { func: Box<SpannedExpr<Id>>, implicit_args: Vec<SpannedExpr<Id>>, args: Vec<SpannedExpr<Id>>, }, Lambda(Lambda<Id>), IfElse(Box<SpannedExpr<Id>>, Box<SpannedExpr<Id>>, Box<SpannedExpr<Id>>), Match(Box<SpannedExpr<Id>>, Vec<Alternative<Id>>), Infix { lhs: Box<SpannedExpr<Id>>, op: SpannedIdent<Id>, rhs: Box<SpannedExpr<Id>>, implicit_args: Vec<SpannedExpr<Id>>, }, Projection(Box<SpannedExpr<Id>>, Id, ArcType<Id>), Array(Array<Id>), Record { typ: ArcType<Id>, types: Vec<ExprField<Id, ArcType<Id>>>, exprs: Vec<ExprField<Id, SpannedExpr<Id>>>, base: Option<Box<SpannedExpr<Id>>>, }, Tuple { typ: ArcType<Id>, elems: Vec<SpannedExpr<Id>>, }, LetBindings(Vec<ValueBinding<Id>>, Box<SpannedExpr<Id>>), TypeBindings(Vec<TypeBinding<Id>>, Box<SpannedExpr<Id>>), Block(Vec<SpannedExpr<Id>>), Do(Do<Id>), MacroExpansion { original: Box<SpannedExpr<Id>>, replacement: Box<SpannedExpr<Id>>, }, Error(Option<ArcType<Id>>), }
The representation of gluon's expression syntax
Variants
Ident(TypedIdent<Id>)
Identifiers
Literal(Literal)
Literal values
App
Function application, eg. f x
Fields of App
func: Box<SpannedExpr<Id>> | |
implicit_args: Vec<SpannedExpr<Id>> | |
args: Vec<SpannedExpr<Id>> |
Lambda(Lambda<Id>)
Lambda abstraction, eg. \x y -> x * y
IfElse(Box<SpannedExpr<Id>>, Box<SpannedExpr<Id>>, Box<SpannedExpr<Id>>)
If-then-else conditional
Match(Box<SpannedExpr<Id>>, Vec<Alternative<Id>>)
Pattern match expression
Infix
Infix operator expression eg. f >> g
Fields of Infix
lhs: Box<SpannedExpr<Id>> | |
op: SpannedIdent<Id> | |
rhs: Box<SpannedExpr<Id>> | |
implicit_args: Vec<SpannedExpr<Id>> |
Projection(Box<SpannedExpr<Id>>, Id, ArcType<Id>)
Record field projection, eg. value.field
Array(Array<Id>)
Array construction
Record
Record construction
Fields of Record
typ: ArcType<Id> | |
types: Vec<ExprField<Id, ArcType<Id>>> | |
exprs: Vec<ExprField<Id, SpannedExpr<Id>>> | |
base: Option<Box<SpannedExpr<Id>>> |
Tuple
Tuple construction
Fields of Tuple
typ: ArcType<Id> | |
elems: Vec<SpannedExpr<Id>> |
LetBindings(Vec<ValueBinding<Id>>, Box<SpannedExpr<Id>>)
Declare a series of value bindings
TypeBindings(Vec<TypeBinding<Id>>, Box<SpannedExpr<Id>>)
Declare a series of type aliases
Block(Vec<SpannedExpr<Id>>)
A group of sequenced expressions
Do(Do<Id>)
MacroExpansion
Fields of MacroExpansion
original: Box<SpannedExpr<Id>> | |
replacement: Box<SpannedExpr<Id>> |
Error(Option<ArcType<Id>>)
An invalid expression
Methods
impl<Id> Expr<Id>
[src]
impl<Id> Expr<Id>
ⓘImportant traits for Box<R>pub fn field_iter<'a>(
&'a self
) -> Box<Iterator<Item = Either<&'a ExprField<Id, ArcType<Id>>, &'a ExprField<Id, SpannedExpr<Id>>>> + 'a>
[src]
ⓘImportant traits for Box<R>
pub fn field_iter<'a>(
&'a self
) -> Box<Iterator<Item = Either<&'a ExprField<Id, ArcType<Id>>, &'a ExprField<Id, SpannedExpr<Id>>>> + 'a>
Trait Implementations
impl<Id: Clone> Clone for Expr<Id>
[src]
impl<Id: Clone> Clone for Expr<Id>
fn clone(&self) -> Expr<Id>
[src]
fn clone(&self) -> Expr<Id>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl<Id: PartialEq> PartialEq for Expr<Id>
[src]
impl<Id: PartialEq> PartialEq for Expr<Id>
fn eq(&self, other: &Expr<Id>) -> bool
[src]
fn eq(&self, other: &Expr<Id>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Expr<Id>) -> bool
[src]
fn ne(&self, other: &Expr<Id>) -> bool
This method tests for !=
.
impl<Id: Debug> Debug for Expr<Id>
[src]
impl<Id: Debug> Debug for Expr<Id>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Typed for Expr<Symbol>
[src]
impl Typed for Expr<Symbol>