tipc
A TIP to LLVM compiler
Public Member Functions | List of all members
SyntaxTree Class Reference

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)
 
SyntaxTreeoperator= (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< ASTNodegetRoot () const
 Return the root of the tree. More...
 
void accept (ASTVisitor *visitor)
 Apply the visitor to the root of the tree. More...
 
std::vector< SyntaxTreegetSubtrees ()
 Return the children of the root as collection of SyntaxTrees. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SyntaxTree() [1/2]

SyntaxTree::SyntaxTree ( std::shared_ptr< ASTNode node)

◆ ~SyntaxTree()

SyntaxTree::~SyntaxTree ( )
default

◆ SyntaxTree() [2/2]

SyntaxTree::SyntaxTree ( SyntaxTree const &  tree)
default

Member Function Documentation

◆ accept()

SyntaxTree::accept ( ASTVisitor visitor)

Apply the visitor to the root of the tree.

Parameters
visitorThe visitor to apply.

◆ begin() [1/2]

Iterator SyntaxTree::begin ( std::string const &  order)

◆ begin() [2/2]

Iterator SyntaxTree::begin ( std::string const &  order) const

◆ end()

SyntaxTree::end ( std::string const &  order)

Construct an iterator pointing at the end of the tree.

Parameters
orderthe traversal order. Currently, only pre-order is supported.

◆ getRoot()

SyntaxTree::getRoot ( ) const

Return the root of the tree.

◆ getSubtrees()

SyntaxTree::getSubtrees ( )

Return the children of the root as collection of SyntaxTrees.

◆ operator=()

SyntaxTree & SyntaxTree::operator= ( SyntaxTree const &  tree)

The documentation for this class was generated from the following files: