Skip to content

RoseAst::iterator

AST iterator.

Synopsis

Declared in <src/midend/abstractLayer/RoseAst.h>

class iterator;

Member Functions

Name

Description

iterator [constructor]

Constructors

current_node_id

is_at_first_child

Test whether iterator is at the first child of its parent.

is_at_last_child

Test whether iterator as at the last child of its parent.

is_at_root

Test whether iterator is pointing to root node of AST to be traversed.

is_past_the_end

operator*

Dereference an iterator.

operator++

Advance the iterator.

parent

Parent AST node relative to the iteration.

parent_node_id

print_top_element

skipChildrenOnForward

Cause children to be skipped on the next advancement.

stack_size

Depth of traversal.

withNullValues

withTemplates

withoutNullValues

Mode to enable or disable skipping null child pointers.

withoutTemplates

@}

operator==

Test iterator equality.

operator!=

Test iterator inequality.

Private Types

Private Member Functions

Private Data Members

Name

_stack

Private Static Data Members

Friends

Name

Description

RoseAst

Interface for iterating over an AST.

Description

This is an STL‐compliant forward iterator for traversing AST nodes in depth‐first pre‐order. The withoutNullValues and withNullValues functions control whether the traversal follows null child pointers (the default is that null pointers are not followed). Entire subtrees can be excluded from traversal with the skipChildrenOnForward function.

The iterator also provides a number of auxiliary functions for querying some structural properties of the AST w.r.t. the position in the traversal (e.g., is_at_first_child, is_at_last_child, is_at_root, parent, etc.).

Note

Comparison of iterators is also correct for null values. Only if two iterators refer to the same (identical) null value, they are equal, otherwise they are not. If they refer to different null values they are different. Hence, different null values in the AST are treated like different nodes. This is necessary to allow STL algorithms to work properly on the AST.

Created with MrDocs