pub enum ExprData {
Show 16 variants
Variable(Node<IdentifierData>),
IntConst(i32),
UIntConst(u32),
BoolConst(bool),
FloatConst(f32),
DoubleConst(f64),
Unary(Node<UnaryOpData>, Box<Node<ExprData>>),
Binary(Node<BinaryOpData>, Box<Node<ExprData>>, Box<Node<ExprData>>),
Ternary(Box<Node<ExprData>>, Box<Node<ExprData>>, Box<Node<ExprData>>),
Assignment(Box<Node<ExprData>>, Node<AssignmentOpData>, Box<Node<ExprData>>),
Bracket(Box<Node<ExprData>>, Box<Node<ExprData>>),
FunCall(Node<FunIdentifierData>, Vec<Node<ExprData>>),
Dot(Box<Node<ExprData>>, Node<IdentifierData>),
PostInc(Box<Node<ExprData>>),
PostDec(Box<Node<ExprData>>),
Comma(Box<Node<ExprData>>, Box<Node<ExprData>>),
}
Expand description
The most general form of an expression.
As you can see if you read the variant list, in GLSL, an assignment is an expression. This is a bit silly but think of an assignment as a statement first then an expression which evaluates to what the statement “returns”.
An expression is either an assignment or a list (comma) of assignments.
Variants§
Variable(Node<IdentifierData>)
A variable expression, using an identifier.
IntConst(i32)
Integral constant expression.
UIntConst(u32)
Unsigned integral constant expression.
BoolConst(bool)
Boolean constant expression.
FloatConst(f32)
Single precision floating expression.
DoubleConst(f64)
Double precision floating expression.
Unary(Node<UnaryOpData>, Box<Node<ExprData>>)
A unary expression, gathering a single expression and a unary operator.
Binary(Node<BinaryOpData>, Box<Node<ExprData>>, Box<Node<ExprData>>)
A binary expression, gathering two expressions and a binary operator.
Ternary(Box<Node<ExprData>>, Box<Node<ExprData>>, Box<Node<ExprData>>)
A ternary conditional expression, gathering three expressions.
Assignment(Box<Node<ExprData>>, Node<AssignmentOpData>, Box<Node<ExprData>>)
An assignment is also an expression. Gathers an expression that defines what to assign to, an assignment operator and the value to associate with.
Bracket(Box<Node<ExprData>>, Box<Node<ExprData>>)
Add an array specifier to an expression.
FunCall(Node<FunIdentifierData>, Vec<Node<ExprData>>)
A functional call. It has a function identifier and a list of expressions (arguments).
Dot(Box<Node<ExprData>>, Node<IdentifierData>)
An expression associated with a field selection (struct).
PostInc(Box<Node<ExprData>>)
Post-incrementation of an expression.
PostDec(Box<Node<ExprData>>)
Post-decrementation of an expression.
Comma(Box<Node<ExprData>>, Box<Node<ExprData>>)
An expression that contains several, separated with comma.
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for ExprData
impl<'de> Deserialize<'de> for ExprData
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ExprData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ExprData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl From<ExprData> for InitializerData
impl From<ExprData> for InitializerData
source§fn from(e: ExprData) -> InitializerData
fn from(e: ExprData) -> InitializerData
source§impl HasPrecedence for ExprData
impl HasPrecedence for ExprData
source§fn precedence(&self) -> u32
fn precedence(&self) -> u32
source§impl NodeContent for ExprData
impl NodeContent for ExprData
source§fn into_node<T>(self) -> Node<T>where
T: From<Self> + NodeContent,
fn into_node<T>(self) -> Node<T>where
T: From<Self> + NodeContent,
source§fn spanned(self, start: LexerPosition, end: LexerPosition) -> Node<Self>
fn spanned(self, start: LexerPosition, end: LexerPosition) -> Node<Self>
source§impl NodeContentDisplay for ExprData
impl NodeContentDisplay for ExprData
source§impl Serialize for ExprData
impl Serialize for ExprData
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ExprData
Auto Trait Implementations§
impl Freeze for ExprData
impl RefUnwindSafe for ExprData
impl Send for ExprData
impl Sync for ExprData
impl Unpin for ExprData
impl UnwindSafe for ExprData
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more