lang_c::ast

Enum Expression

Source
pub enum Expression {
Show 18 variants Identifier(Box<Node<Identifier>>), Constant(Box<Node<Constant>>), StringLiteral(Box<Node<StringLiteral>>), GenericSelection(Box<Node<GenericSelection>>), Member(Box<Node<MemberExpression>>), Call(Box<Node<CallExpression>>), CompoundLiteral(Box<Node<CompoundLiteral>>), SizeOfTy(Box<Node<SizeOfTy>>), SizeOfVal(Box<Node<SizeOfVal>>), AlignOf(Box<Node<AlignOf>>), UnaryOperator(Box<Node<UnaryOperatorExpression>>), Cast(Box<Node<CastExpression>>), BinaryOperator(Box<Node<BinaryOperatorExpression>>), Conditional(Box<Node<ConditionalExpression>>), Comma(Box<Vec<Node<Expression>>>), OffsetOf(Box<Node<OffsetOfExpression>>), VaArg(Box<Node<VaArgExpression>>), Statement(Box<Node<Statement>>),
}
Expand description

Expressions

(C11 6.5)

Variants§

§

Identifier(Box<Node<Identifier>>)

Identifier

May be a variable, function name or enumerator. The latter is different from the standard, where enumerators are classified as constants.

(C11 6.5.1)

§

Constant(Box<Node<Constant>>)

Numeric and character constants

Enumerator constants, being valid identifiers, are reprented as Identifier in this enum.

(C11 6.5.1)

§

StringLiteral(Box<Node<StringLiteral>>)

String literal

(C11 6.5.1)

§

GenericSelection(Box<Node<GenericSelection>>)

Generic selection

(C11 6.5.1.1)

§

Member(Box<Node<MemberExpression>>)

Structure and union members

Both direct (.) and indirect (->) access.

(C11 6.5.2)

§

Call(Box<Node<CallExpression>>)

Function call expression

(C11 6.5.2)

§

CompoundLiteral(Box<Node<CompoundLiteral>>)

Compound literal

(C11 6.5.2)

§

SizeOfTy(Box<Node<SizeOfTy>>)

Size of a type

(C11 6.5.3)

§

SizeOfVal(Box<Node<SizeOfVal>>)

Size of a unary expression

(C11 6.5.3)

§

AlignOf(Box<Node<AlignOf>>)

Alignment of a type

(C11 6.5.3)

§

UnaryOperator(Box<Node<UnaryOperatorExpression>>)

Unary operators

This represents both postfix and prefix unary oprators. Postfix expressions that take additional operands are represented by a separate entry in this enum.

(C11 6.5.2, c11 6.5.3)

§

Cast(Box<Node<CastExpression>>)

Cast expression

(type) expr

(C11 6.5.4)

§

BinaryOperator(Box<Node<BinaryOperatorExpression>>)

Binary operators

All of C binary operators that can be applied to two expressions.

(C11 6.5.5 – 6.5.16)

§

Conditional(Box<Node<ConditionalExpression>>)

Conditional operator

(C11 6.5.15)

§

Comma(Box<Vec<Node<Expression>>>)

Comma operator

(C11 6.5.17)

§

OffsetOf(Box<Node<OffsetOfExpression>>)

Member offset expression

Result of expansion of offsetof macro.

(C11 7.19 §3).

§

VaArg(Box<Node<VaArgExpression>>)

Variable argument list access

Result of expansion of va_arg macro.

(C11 7.16.1.1).

§

Statement(Box<Node<Statement>>)

Statement expression

GNU extension

Trait Implementations§

Source§

impl Clone for Expression

Source§

fn clone(&self) -> Expression

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Expression

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Expression

Source§

fn eq(&self, other: &Expression) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Expression

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.