ROSE 0.11.145.192
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Rosebud::Ast::TokenList Class Reference

Description

Node that holds a sequence of consecutive tokens from an input file.

Definition at line 78 of file Ast.h.

#include <Rosebud/Ast.h>

Inheritance diagram for Rosebud::Ast::TokenList:
Inheritance graph
[legend]
Collaboration diagram for Rosebud::Ast::TokenList:
Collaboration graph
[legend]

Public Types

using Ptr = TokenListPtr
 Shared-ownership pointer.
 
- Public Types inherited from Rosebud::Ast::Node
using Ptr = NodePtr
 
- Public Types inherited from Sawyer::Tree::Vertex< Node >
using UserBase = Node
 User's base class.
 
using UserBasePtr = std::shared_ptr< UserBase >
 Pointer to user's base class.
 
using TraversalEvent = Sawyer::Tree::TraversalEvent
 Alias for traversal events.
 

Public Member Functions

bool empty () const
 True if there are no tokens in this node.
 
size_t size () const
 Number of tokens.
 
void push_back (const Token &token)
 Insert a token at the end of the list.
 
std::string string ()
 Return the text for all tokens in this list.
 
std::string string (const FilePtr &)
 Return the text for all tokens in this list.
 
void string (const std::string &)
 Return the text for all tokens in this list.
 
std::vector< Token >::iterator begin ()
 Iterators.
 
std::vector< Token >::iterator end ()
 Iterators.
 
- Public Member Functions inherited from Rosebud::Ast::Node
template<class T >
std::shared_ptr< T > findAncestor ()
 
- Public Member Functions inherited from Sawyer::Tree::Vertex< Node >
UserBasePtr pointer ()
 Returns a shared pointer to this vertex.
 
std::shared_ptr< T > isa ()
 Tests whether this object is a certain type.
 
auto traverseReverse (const Visitor &visitor)
 Traverse in reverse direction from children to parents.
 
auto traverse (const Visitor &visitor)
 Traverse in forward direction from parents to children.
 
auto traversePre (const Visitor &visitor)
 Pre-order forward traversal.
 
auto traversePost (const Visitor &visitor)
 Post-order forward traversal.
 
std::shared_ptr< T > findFirstAncestor ()
 Traversal that finds the closest ancestor of type T or derived from T.
 
std::shared_ptr< T > findLastAncestor ()
 Traversal that finds the farthest ancestor of type T or derived from T.
 
std::vector< std::shared_ptr< T > > findDescendants ()
 Traversal that finds all the descendants of a particular type.
 
UserBasePtr child (size_t i) const
 Returns the pointer for a child.
 
size_t nChildren () const
 Returns the number of children.
 

Static Public Member Functions

static Ptr instance ()
 Allocating constructor.
 

Public Attributes

std::vector< Tokentokens
 The ordered tokens.
 
- Public Attributes inherited from Sawyer::Tree::Vertex< Node >
ReverseEdge parent
 Pointer to the parent in the tree.
 

Protected Member Functions

 TokenList ()
 Default constructor used only by derived classes.
 
- Protected Member Functions inherited from Sawyer::Tree::Vertex< Node >
virtual void destructorHelper ()
 

Member Typedef Documentation

◆ Ptr

Shared-ownership pointer.

Definition at line 81 of file Ast.h.

Member Function Documentation

◆ string() [1/3]

std::string Rosebud::Ast::TokenList::string ( )

Return the text for all tokens in this list.

The string representation is cached so the same value is always returned. This node must have a File ancestor unless a file is provided or the string is already cached. If a string is provided as an argument, it overrides the cached value.

◆ string() [2/3]

std::string Rosebud::Ast::TokenList::string ( const FilePtr )

Return the text for all tokens in this list.

The string representation is cached so the same value is always returned. This node must have a File ancestor unless a file is provided or the string is already cached. If a string is provided as an argument, it overrides the cached value.

◆ string() [3/3]

void Rosebud::Ast::TokenList::string ( const std::string &  )

Return the text for all tokens in this list.

The string representation is cached so the same value is always returned. This node must have a File ancestor unless a file is provided or the string is already cached. If a string is provided as an argument, it overrides the cached value.

◆ begin()

std::vector< Token >::iterator Rosebud::Ast::TokenList::begin ( )
inline

Iterators.

Definition at line 121 of file Ast.h.

References tokens.

◆ end()

std::vector< Token >::iterator Rosebud::Ast::TokenList::end ( )
inline

Iterators.

Definition at line 124 of file Ast.h.

References tokens.

Member Data Documentation

◆ tokens

std::vector<Token> Rosebud::Ast::TokenList::tokens

The ordered tokens.

Definition at line 88 of file Ast.h.

Referenced by begin(), and end().


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