pub enum Expr<'t> where
't: 't, {
Binary(BinaryOp, Box<Spanned<'t, Expr<'t>>>, Box<Spanned<'t, Expr<'t>>>),
Unary(UnaryOp, Box<Spanned<'t, Expr<'t>>>),
MethodInvocation(Box<Spanned<'t, Expr<'t>>>, Spanned<'t, Symbol<'t>>, Spanned<'t, Vec<Spanned<'t, Expr<'t>>>>),
FieldAccess(Box<Spanned<'t, Expr<'t>>>, Spanned<'t, Symbol<'t>>),
ArrayAccess(Box<Spanned<'t, Expr<'t>>>, Box<Spanned<'t, Expr<'t>>>),
Null,
Boolean(bool),
Int(Spanned<'t, &'t str>),
NegInt(Spanned<'t, &'t str>),
Var(Spanned<'t, Symbol<'t>>),
ThisMethodInvocation(Spanned<'t, Symbol<'t>>, Spanned<'t, Vec<Spanned<'t, Expr<'t>>>>),
This,
NewObject(Spanned<'t, Symbol<'t>>),
NewArray(Spanned<'t, BasicType<'t>>, Box<Spanned<'t, Expr<'t>>>, u64),
}
An expression is either one of
Assignment
: an assignment expression
Binary
: one of the binary operations defined in BinaryOp
Unary
: one of the unary operations defined in UnaryOp
MethodInvocation
: a method invocation on a primary expression:
foo.method()
FieldAccess
: a field access on a primary expression:
foo.bar
ArrayAccess
: an array access on a primary expression:
foo[42]
The primary expression from the original grammar are also part of this,
since the distinction is only required for correct postfix-op parsing. These
are:
Null
: the null
keyword
Boolean
: a boolean literal
Int
: an integer literal
Var
: use of a variable
MethodInvocation
: a method invocation
This
: the this
keyword
NewObject
: generating a new object, e.g. new Foo()
NewArray
: generating a new array, e.g. new int[]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Formats the value using the given formatter. Read more
Performs copy-assignment from source
. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static