pub enum Expression {
Show 20 variants
Call(CallExpression),
Assignment(Assignment),
Binary(BinaryExpression),
Unary(UnaryExpression),
Identifier(IdentifierExpression),
FieldAccess(FieldAccessExpression),
StringLiteral(StringLiteralExpression),
NumberLiteral(NumberLiteralExpression),
Null(NullExpression),
Boolean(BooleanExpression),
Cast(CastExpression),
Conditional(ConditionalExpression),
Sizeof(SizeofExpression),
Subscript(SubscriptExpression),
InitializerList(InitializerListExpression),
CharLiteral(CharLiteralExpression),
Update(UpdateExpression),
Comment(CommentExpression),
OffsetOf(OffsetOfExpression),
Generic(GenericExpression),
}Variants§
Call(CallExpression)
Assignment(Assignment)
Binary(BinaryExpression)
Unary(UnaryExpression)
Identifier(IdentifierExpression)
FieldAccess(FieldAccessExpression)
StringLiteral(StringLiteralExpression)
NumberLiteral(NumberLiteralExpression)
Null(NullExpression)
Boolean(BooleanExpression)
Cast(CastExpression)
Conditional(ConditionalExpression)
Sizeof(SizeofExpression)
Subscript(SubscriptExpression)
InitializerList(InitializerListExpression)
CharLiteral(CharLiteralExpression)
Update(UpdateExpression)
Comment(CommentExpression)
OffsetOf(OffsetOfExpression)
Generic(GenericExpression)
Implementations§
Source§impl Expression
impl Expression
pub fn location(&self) -> &SourceLocation
Sourcepub fn to_source_string<'a>(&self, source: &'a [u8]) -> Option<&'a str>
pub fn to_source_string<'a>(&self, source: &'a [u8]) -> Option<&'a str>
Convert this expression back to source text
Sourcepub fn walk<'s, F>(&'s self, f: &mut F)where
F: FnMut(&'s Self),
pub fn walk<'s, F>(&'s self, f: &mut F)where
F: FnMut(&'s Self),
Recursively walk all nested expressions. The closure receives a
&'s Expression tied to self’s lifetime, so references extracted
inside the closure can be stored in an outer Vec<&'s T>.
Sourcepub fn extract_variable_name<'a>(&self, source: &'a [u8]) -> Option<&'a str>
pub fn extract_variable_name<'a>(&self, source: &'a [u8]) -> Option<&'a str>
Extract variable name from simple expressions (Identifier or FieldAccess)
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Check if this expression is NULL Handles both Expression::Null and the identifier “NULL” (common in C code)
Sourcepub fn is_string_literal(&self) -> bool
pub fn is_string_literal(&self) -> bool
Check if this expression is a string literal
Sourcepub fn extract_string_value(&self) -> Option<String>
pub fn extract_string_value(&self) -> Option<String>
Extract string literal value, unwrapping macro calls like I_(“string”) Returns the string without quotes
Sourcepub fn is_string_or_macro_string(&self) -> bool
pub fn is_string_or_macro_string(&self) -> bool
Check if this is a string literal or a macro wrapping a string literal
Sourcepub fn contains_identifier(&self, name: &str) -> bool
pub fn contains_identifier(&self, name: &str) -> bool
Check if this expression contains an identifier with the given name Recursively searches through the entire expression tree
Sourcepub fn collect_identifiers(&self) -> Vec<String>
pub fn collect_identifiers(&self) -> Vec<String>
Collect all identifiers in this expression Returns a list of all identifier names found in the expression tree
Sourcepub fn is_call_to(&self, function_name: &str) -> bool
pub fn is_call_to(&self, function_name: &str) -> bool
Check if this expression is a call to the specified function
Sourcepub fn is_call_to_any(&self, function_names: &[&str]) -> bool
pub fn is_call_to_any(&self, function_names: &[&str]) -> bool
Check if this expression is a call to any of the specified functions
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more