Bash++
Bash++ compiler internal documentation
Public Member Functions | List of all members
AST::StringType Class Referenceabstract

Base class for string-type nodes in the AST. More...

#include <StringType.h>

Inheritance diagram for AST::StringType:
Inheritance graph
[legend]
Collaboration diagram for AST::StringType:
Collaboration graph
[legend]

Public Member Functions

void addText (const AST::Token< std::string > &text)
 Adds text to the string, either by appending to the last RawText child or creating a new one. The result should be that the node contains an alternating sequence of RawText nodes and interpolations, each RawText node holding a contiguous segment of text.
 
void addText (const std::string &text)
 
std::ostream & prettyPrint (std::ostream &os, int indentation_level=0) const =0
 
- Public Member Functions inherited from AST::ASTNode
 ASTNode ()=default
 
virtual constexpr AST::NodeType getType () const =0
 
void addChild (const std::shared_ptr< ASTNode > &child)
 Add a child node to this AST node. This function also:
 
void addChildren (const std::vector< std::shared_ptr< ASTNode > > &childs)
 Add a vector of child nodes to this AST node. This function also:
 
const std::vector< std::shared_ptr< ASTNode > > & getChildren () const
 
void setPosition (const AST::FilePosition &pos)
 
void setPosition (uint32_t line, uint32_t column)
 
const AST::FilePositiongetPosition () const
 
void setEndPosition (const AST::FilePosition &pos)
 
void setEndPosition (uint32_t line, uint32_t column)
 
const AST::FilePositiongetEndPosition () const
 
uint32_t getLine () const
 
uint32_t getCharPositionInLine () const
 
std::shared_ptr< ASTNodegetChildAt (size_t index) const
 
std::shared_ptr< ASTNodegetFirstChild () const
 
std::shared_ptr< ASTNodegetLastChild () const
 
size_t getChildrenCount () const
 
void clear ()
 
void clearChildren ()
 

Additional Inherited Members

- Protected Attributes inherited from AST::ASTNode
std::vector< std::shared_ptr< ASTNode > > children
 
AST::FilePosition position
 
AST::FilePosition end_position
 

Detailed Description

Base class for string-type nodes in the AST.

This class is only to be used as a common ancestor for string-related nodes, like DoublequotedString. It should not be used directly to create AST nodes.

Member Function Documentation

◆ addText() [1/2]

void AST::StringType::addText ( const AST::Token< std::string > &  text)
inline

Adds text to the string, either by appending to the last RawText child or creating a new one. The result should be that the node contains an alternating sequence of RawText nodes and interpolations, each RawText node holding a contiguous segment of text.

Parameters
textThe text to add.

◆ addText() [2/2]

void AST::StringType::addText ( const std::string &  text)
inline

◆ prettyPrint()

std::ostream & AST::StringType::prettyPrint ( std::ostream &  os,
int  indentation_level = 0 
) const
pure virtual

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