ROSE 0.11.145.147
|
Information about C preprocessor conditional compilation directives.
#include <Rosebud/Ast.h>
Classes | |
struct | Directive |
Conditional compilation directive. More... | |
Public Types | |
enum class | Type { IF , ELSE , END , OTHER } |
Type of CPP directive. More... | |
using | Ptr = CppStackPtr |
Shared-ownership pointer. | |
using | Level = std::list< Directive > |
The CPP directives that belong to the same level. | |
using | Stack = std::vector< Level > |
A stack of nested conditional compilation directives. | |
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 | printError (const FilePtr &file) const |
Print an error message for the top of the stack if there's something wrong with it. | |
void | emitOpen (std::ostream &) |
Emit all control flow directives in this stack. | |
void | emitClose (std::ostream &) |
Emit matching #endif for all control flow directives in this stack. | |
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. | |
static Type | type (const std::string &directive) |
Type of directive. | |
static bool | process (const FilePtr &, const Token &directive, Stack &runningStack) |
Adjust the stack based on the C preprocessor directive. | |
Public Attributes | |
Stack | stack |
The stack of nested conditional compilation directives. | |
Public Attributes inherited from Sawyer::Tree::Vertex< Node > | |
ReverseEdge | parent |
Pointer to the parent in the tree. | |
Protected Member Functions | |
CppStack () | |
Default constructor used only by derived classes. | |
Protected Member Functions inherited from Sawyer::Tree::Vertex< Node > | |
virtual void | destructorHelper () |
using Rosebud::Ast::CppStack::Level = std::list<Directive> |
using Rosebud::Ast::CppStack::Stack = std::vector<Level> |
|
strong |
|
static |
Adjust the stack based on the C preprocessor directive.
Returns true if the stack was adjusted, false otherwise.
bool Rosebud::Ast::CppStack::printError | ( | const FilePtr & | file | ) | const |
Print an error message for the top of the stack if there's something wrong with it.
Returns true if an error was printed.
Stack Rosebud::Ast::CppStack::stack |