pub struct AstNode {
pub stmt: AstStatement,
pub id: AstId,
pub location: SourceLocation,
pub metadata: Option<MetaData>,
}Fields§
§stmt: AstStatement§id: AstId§location: SourceLocation§metadata: Option<MetaData>Implementations§
Source§impl AstNode
impl AstNode
Sourcepub fn get_as_list(&self) -> Vec<&AstNode>
pub fn get_as_list(&self) -> Vec<&AstNode>
Returns the statement in a singleton list, or the contained statements if the statement is already a list
pub fn get_location(&self) -> SourceLocation
pub fn set_location(&mut self, location: SourceLocation)
pub fn get_id(&self) -> AstId
pub fn get_stmt(&self) -> &AstStatement
pub fn get_stmt_mut(&mut self) -> &mut AstStatement
Sourcepub fn get_stmt_peeled(&self) -> &AstStatement
pub fn get_stmt_peeled(&self) -> &AstStatement
Similar to AstNode::get_stmt with the exception of peeling parenthesized expressions.
For example if called on ((1)) this function would return a AstStatement::Literal ignoring the
parenthesized expressions altogether.
Sourcepub fn is_struct_literal_initializer(&self) -> bool
pub fn is_struct_literal_initializer(&self) -> bool
Returns true if this node represents a struct literal initializer,
i.e. a (possibly parenthesized) expression list or named assignment
like (a := 1, b := 2) or (field := value).
pub fn get_node_peeled(&self) -> &AstNode
pub fn get_metadata(&self) -> Option<&MetaData>
Sourcepub fn has_direct_access(&self) -> bool
pub fn has_direct_access(&self) -> bool
Returns true if the current statement has a direct access.
Sourcepub fn is_cast_prefix_eligible(&self) -> bool
pub fn is_cast_prefix_eligible(&self) -> bool
returns true if this AST Statement is a literal or reference that can be prefixed with a type-cast (e.g. INT#23)
Sourcepub fn is_flat_reference(&self) -> bool
pub fn is_flat_reference(&self) -> bool
Returns true if the current statement is a flat reference (e.g. a)
Sourcepub fn get_flat_reference_name(&self) -> Option<&str>
pub fn get_flat_reference_name(&self) -> Option<&str>
Returns the reference-name if this is a flat reference like a, or None if this is no flat reference
pub fn get_parent_name_of_reference(&self) -> Option<&str>
pub fn get_label_name(&self) -> Option<&str>
pub fn is_empty_statement(&self) -> bool
pub fn is_assignment(&self) -> bool
pub fn is_output_assignment(&self) -> bool
pub fn is_reference(&self) -> bool
pub fn is_member_access(&self) -> bool
pub fn get_initial_base(&self) -> Option<&AstNode>
pub fn get_identifier(&self) -> Option<&AstNode>
pub fn is_call(&self) -> bool
pub fn is_hardware_access(&self) -> bool
pub fn is_array_access(&self) -> bool
pub fn is_pointer_access(&self) -> bool
pub fn is_this(&self) -> bool
pub fn is_this_deref(&self) -> bool
pub fn is_paren(&self) -> bool
pub fn is_expression_list(&self) -> bool
pub fn is_super(&self) -> bool
pub fn is_super_deref(&self) -> bool
pub fn is_super_or_super_deref(&self) -> bool
pub fn has_super_metadata(&self) -> bool
pub fn has_super_metadata_deref(&self) -> bool
pub fn can_be_assigned_to(&self) -> bool
pub fn new( stmt: AstStatement, id: AstId, location: impl Into<SourceLocation>, ) -> AstNode
pub fn new_literal( kind: AstLiteral, id: AstId, location: SourceLocation, ) -> AstNode
pub fn new_integer(value: i128, id: AstId, location: SourceLocation) -> AstNode
pub fn new_real(value: String, id: AstId, location: SourceLocation) -> AstNode
pub fn new_string( value: impl Into<String>, is_wide: bool, id: AstId, location: SourceLocation, ) -> AstNode
pub fn is_binary_expression(&self) -> bool
pub fn is_literal_array(&self) -> bool
pub fn is_literal(&self) -> bool
pub fn is_literal_integer(&self) -> bool
pub fn get_literal_integer_value(&self) -> Option<i128>
pub fn is_identifier(&self) -> bool
pub fn is_default_value(&self) -> bool
Sourcepub fn negate(self: AstNode, id_provider: IdProvider) -> AstNode
pub fn negate(self: AstNode, id_provider: IdProvider) -> AstNode
Negates the given element by adding it to a not expression
pub fn is_template(&self) -> bool
pub fn with_metadata(self, metadata: MetaData) -> AstNode
pub fn is_deref(&self) -> bool
pub fn get_call_operator(&self) -> Option<&AstNode>
pub fn get_ref_expr_mut(&mut self) -> Option<&mut ReferenceExpr>
pub fn get_deref_expr(&self) -> Option<&ReferenceExpr>
pub fn get_base_ref_expr(&self) -> Option<&AstNode>
pub fn get_base_ref_expr_mut(&mut self) -> Option<&mut AstNode>
pub fn as_string(&self) -> String
pub fn is_real(&self) -> bool
Sourcepub fn get_assignment_identifier(&self) -> Option<&str>
pub fn get_assignment_identifier(&self) -> Option<&str>
Returns the identifier of the left-hand side if this is an assignment statement