|
tipc
A TIP to LLVM compiler
|
A convenient interface to the AST nodes. More...
#include <SyntaxTree.h>
Public Member Functions | |
| SyntaxTree (std::shared_ptr< ASTNode > node) | |
| ~SyntaxTree () | |
| SyntaxTree (SyntaxTree const &tree) | |
| SyntaxTree & | operator= (SyntaxTree const &tree) |
| Iterator | begin (std::string const &order) |
| Iterator | begin (std::string const &order) const |
| Iterator | end (std::string const &order) |
| Construct an iterator pointing at the end of the tree. More... | |
| std::shared_ptr< ASTNode > | getRoot () const |
| Return the root of the tree. More... | |
| void | accept (ASTVisitor *visitor) |
| Apply the visitor to the root of the tree. More... | |
| std::vector< SyntaxTree > | getSubtrees () |
| Return the children of the root as collection of SyntaxTrees. More... | |
A convenient interface to the AST nodes.
The SyntaxTree abstraction provides an interface for working with the AST. It shelters clients from having to learn low-level details about the nodes. For instance, STL like iterators are provided that handle traversal for you.
| SyntaxTree::SyntaxTree | ( | std::shared_ptr< ASTNode > | node | ) |
|
default |
|
default |
| SyntaxTree::accept | ( | ASTVisitor * | visitor | ) |
Apply the visitor to the root of the tree.
| visitor | The visitor to apply. |
| Iterator SyntaxTree::begin | ( | std::string const & | order | ) |
| Iterator SyntaxTree::begin | ( | std::string const & | order | ) | const |
| SyntaxTree::end | ( | std::string const & | order | ) |
Construct an iterator pointing at the end of the tree.
| order | the traversal order. Currently, only pre-order is supported. |
| SyntaxTree::getRoot | ( | ) | const |
Return the root of the tree.
| SyntaxTree::getSubtrees | ( | ) |
Return the children of the root as collection of SyntaxTrees.
| SyntaxTree & SyntaxTree::operator= | ( | SyntaxTree const & | tree | ) |