Enum gluon_base::ast::Expr[][src]

pub enum Expr<'ast, Id> {
Show 18 variants Ident(TypedIdent<Id>), Literal(Literal), App { func: &'ast mut SpannedExpr<'ast, Id>, implicit_args: &'ast mut [SpannedExpr<'ast, Id>], args: &'ast mut [SpannedExpr<'ast, Id>], }, Lambda(Lambda<'ast, Id>), IfElse(&'ast mut SpannedExpr<'ast, Id>, &'ast mut SpannedExpr<'ast, Id>, &'ast mut SpannedExpr<'ast, Id>), Match(&'ast mut SpannedExpr<'ast, Id>, &'ast mut [Alternative<'ast, Id>]), Infix { lhs: &'ast mut SpannedExpr<'ast, Id>, op: SpannedIdent<Id>, rhs: &'ast mut SpannedExpr<'ast, Id>, implicit_args: &'ast mut [SpannedExpr<'ast, Id>], }, Projection(&'ast mut SpannedExpr<'ast, Id>, Id, ArcType<Id>), Array(Array<'ast, Id>), Record { typ: ArcType<Id>, types: &'ast mut [ExprField<'ast, Id, ArcType<Id>>], exprs: &'ast mut [ExprField<'ast, Id, SpannedExpr<'ast, Id>>], base: Option<&'ast mut SpannedExpr<'ast, Id>>, }, Tuple { typ: ArcType<Id>, elems: &'ast mut [SpannedExpr<'ast, Id>], }, LetBindings(ValueBindings<'ast, Id>, &'ast mut SpannedExpr<'ast, Id>), TypeBindings(&'ast mut [TypeBinding<'ast, Id>], &'ast mut SpannedExpr<'ast, Id>), Block(&'ast mut [SpannedExpr<'ast, Id>]), Do(&'ast mut Do<'ast, Id>), MacroExpansion { original: &'ast mut SpannedExpr<'ast, Id>, replacement: &'ast mut SpannedExpr<'ast, Id>, }, Annotated(&'ast mut SpannedExpr<'ast, Id>, ArcType<Id>), Error(Option<ArcType<Id>>),
}
Expand description

The representation of gluon’s expression syntax

Variants

Ident(TypedIdent<Id>)

Identifiers

Tuple Fields of Ident

0: TypedIdent<Id>
Literal(Literal)

Literal values

Tuple Fields of Literal

0: Literal
App

Function application, eg. f x

Fields of App

func: &'ast mut SpannedExpr<'ast, Id>implicit_args: &'ast mut [SpannedExpr<'ast, Id>]args: &'ast mut [SpannedExpr<'ast, Id>]
Lambda(Lambda<'ast, Id>)

Lambda abstraction, eg. \x y -> x * y

Tuple Fields of Lambda

0: Lambda<'ast, Id>
IfElse(&'ast mut SpannedExpr<'ast, Id>, &'ast mut SpannedExpr<'ast, Id>, &'ast mut SpannedExpr<'ast, Id>)

If-then-else conditional

Tuple Fields of IfElse

0: &'ast mut SpannedExpr<'ast, Id>1: &'ast mut SpannedExpr<'ast, Id>2: &'ast mut SpannedExpr<'ast, Id>
Match(&'ast mut SpannedExpr<'ast, Id>, &'ast mut [Alternative<'ast, Id>])

Pattern match expression

Tuple Fields of Match

0: &'ast mut SpannedExpr<'ast, Id>1: &'ast mut [Alternative<'ast, Id>]
Infix

Infix operator expression eg. f >> g

Fields of Infix

lhs: &'ast mut SpannedExpr<'ast, Id>op: SpannedIdent<Id>rhs: &'ast mut SpannedExpr<'ast, Id>implicit_args: &'ast mut [SpannedExpr<'ast, Id>]
Projection(&'ast mut SpannedExpr<'ast, Id>, Id, ArcType<Id>)

Record field projection, eg. value.field

Tuple Fields of Projection

0: &'ast mut SpannedExpr<'ast, Id>1: Id2: ArcType<Id>
Array(Array<'ast, Id>)

Array construction

Tuple Fields of Array

0: Array<'ast, Id>
Record

Record construction

Fields of Record

typ: ArcType<Id>types: &'ast mut [ExprField<'ast, Id, ArcType<Id>>]exprs: &'ast mut [ExprField<'ast, Id, SpannedExpr<'ast, Id>>]base: Option<&'ast mut SpannedExpr<'ast, Id>>
Tuple

Tuple construction

Fields of Tuple

typ: ArcType<Id>elems: &'ast mut [SpannedExpr<'ast, Id>]
LetBindings(ValueBindings<'ast, Id>, &'ast mut SpannedExpr<'ast, Id>)

Declare a series of value bindings

Tuple Fields of LetBindings

0: ValueBindings<'ast, Id>1: &'ast mut SpannedExpr<'ast, Id>
TypeBindings(&'ast mut [TypeBinding<'ast, Id>], &'ast mut SpannedExpr<'ast, Id>)

Declare a series of type aliases

Tuple Fields of TypeBindings

0: &'ast mut [TypeBinding<'ast, Id>]1: &'ast mut SpannedExpr<'ast, Id>
Block(&'ast mut [SpannedExpr<'ast, Id>])

A group of sequenced expressions

Tuple Fields of Block

0: &'ast mut [SpannedExpr<'ast, Id>]
Do(&'ast mut Do<'ast, Id>)

Tuple Fields of Do

0: &'ast mut Do<'ast, Id>
MacroExpansion

Fields of MacroExpansion

original: &'ast mut SpannedExpr<'ast, Id>replacement: &'ast mut SpannedExpr<'ast, Id>
Annotated(&'ast mut SpannedExpr<'ast, Id>, ArcType<Id>)

Tuple Fields of Annotated

0: &'ast mut SpannedExpr<'ast, Id>1: ArcType<Id>
Error(Option<ArcType<Id>>)

An invalid expression

Tuple Fields of Error

0: Option<ArcType<Id>>

Provides a hint of what type the expression would have, if any

Implementations

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.