RoseAst::iterator
AST iterator.
Synopsis
Declared in <src/midend/abstractLayer/RoseAst.h>
class iterator;
Member Functions
Name |
Description |
|
Constructors |
Test whether iterator is at the first child of its parent. |
|
Test whether iterator as at the last child of its parent. |
|
Test whether iterator is pointing to root node of AST to be traversed. |
|
Dereference an iterator. |
|
Advance the iterator. |
|
Parent AST node relative to the iteration. |
|
Cause children to be skipped on the next advancement. |
|
Depth of traversal. |
|
Mode to enable or disable skipping null child pointers. |
|
@} |
|
Test iterator equality. |
|
Test iterator inequality. |
Protected Data Members
Private Types
Private Member Functions
Private Data Members
Name |
Private Static Data Members
Name |
Friends
Name |
Description |
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