ROSE 0.11.145.192
|
Abstract syntax tree.
This is the tree representation of the abstract syntactic structure of the Rosebud input. Each node of the tree denotes a construct appearing in an input file.
The root of the tree is a Project node, which points to a list of File nodes. Each file points to a list of (usually one) Class nodes. A class is a type of (inherits from) Definition and points to a list of Property nodes. Each property has a data type, initial value, and points to a list of Attribute nodes. Each attribute has a list of arguments that are of each a TokenList node. A token list is simply a list of locations in the input file.
All nodes of the AST are derived from the Node type which, among other things, provides a parent pointer. The parent pointer in a node is adjusted automatically when the node is assigned as a child of another node. All nodes are reference counted and are deleted automatically when they're no longer referenced.
Since nodes are always constructed in the heap and reference counted, their normal C++ constructors are protected. Instead, use the static instance
member functions to construct nodes. Every node also has a Ptr
type which is a std::shared_ptr<T>
for that class of node.
For examples showing how nodes and pointers to children and parents work, see the unit Rosebud AST unit tests. Here's a quick preview:
Classes | |
class | ArgumentList |
A node that holds a list of arguments. More... | |
class | Attribute |
An attribute adjusting the details for a definition. More... | |
class | Class |
Represents a class definition. More... | |
class | CppStack |
Information about C preprocessor conditional compilation directives. More... | |
class | Definition |
Base class for class and property definitions. More... | |
class | File |
An input file. More... | |
class | Node |
Base class of all AST nodes for Rosebud. More... | |
class | Project |
Root of an AST for one or more input files. More... | |
class | Property |
Represents a class property definition. More... | |
class | TokenList |
Node that holds a sequence of consecutive tokens from an input file. More... | |
Typedefs | |
using | NodePtr = std::shared_ptr< Node > |
Shared-ownership pointer to a Node. | |
using | TokenListPtr = std::shared_ptr< TokenList > |
Shared-ownership pointer to a TokenList. | |
using | ArgumentListPtr = std::shared_ptr< ArgumentList > |
Shared-ownership pointer to a ArgumentList. | |
using | CppStackPtr = std::shared_ptr< CppStack > |
Shared-ownership pointer to a CppStack. | |
using | AttributePtr = std::shared_ptr< Attribute > |
Shared-ownership pointer to a Attribute. | |
using | DefinitionPtr = std::shared_ptr< Definition > |
Shared-ownership pointer to a Definition. | |
using | PropertyPtr = std::shared_ptr< Property > |
Shared-ownership pointer to a Property. | |
using | ClassPtr = std::shared_ptr< Class > |
Shared-ownership pointer to a Class. | |
using | FilePtr = std::shared_ptr< File > |
Shared-ownership pointer to a File. | |
using | ProjectPtr = std::shared_ptr< Project > |
Shared-ownership pointer to a Project. | |
using Rosebud::Ast::NodePtr = typedef std::shared_ptr<Node> |
Shared-ownership pointer to a Node.
Definition at line 493 of file Rosebud/BasicTypes.h.
using Rosebud::Ast::TokenListPtr = typedef std::shared_ptr<TokenList> |
Shared-ownership pointer to a TokenList.
Definition at line 495 of file Rosebud/BasicTypes.h.
using Rosebud::Ast::ArgumentListPtr = typedef std::shared_ptr<ArgumentList> |
Shared-ownership pointer to a ArgumentList.
Definition at line 497 of file Rosebud/BasicTypes.h.
using Rosebud::Ast::CppStackPtr = typedef std::shared_ptr<CppStack> |
Shared-ownership pointer to a CppStack.
Definition at line 499 of file Rosebud/BasicTypes.h.
using Rosebud::Ast::AttributePtr = typedef std::shared_ptr<Attribute> |
Shared-ownership pointer to a Attribute.
Definition at line 501 of file Rosebud/BasicTypes.h.
using Rosebud::Ast::DefinitionPtr = typedef std::shared_ptr<Definition> |
Shared-ownership pointer to a Definition.
Definition at line 503 of file Rosebud/BasicTypes.h.
using Rosebud::Ast::PropertyPtr = typedef std::shared_ptr<Property> |
Shared-ownership pointer to a Property.
Definition at line 505 of file Rosebud/BasicTypes.h.
using Rosebud::Ast::ClassPtr = typedef std::shared_ptr<Class> |
Shared-ownership pointer to a Class.
Definition at line 507 of file Rosebud/BasicTypes.h.
using Rosebud::Ast::FilePtr = typedef std::shared_ptr<File> |
Shared-ownership pointer to a File.
Definition at line 509 of file Rosebud/BasicTypes.h.
using Rosebud::Ast::ProjectPtr = typedef std::shared_ptr<Project> |
Shared-ownership pointer to a Project.
Definition at line 511 of file Rosebud/BasicTypes.h.