The basic type-tagged node in the parse tree.
More...
#include <ParseTree.h>
|
size_t | num_children () const |
| Gets the number of children.
|
|
Node * | child (size_t i) const |
| Gets the child at index i.
|
|
Type | get_node_type () const |
| Gets the type of the node.
|
|
std::string | type_string () const |
| Operator to turn Type into a string.
|
|
bool | is_poisoned () const |
| Check if the tree has been poisoned.
|
|
SourceRange | location () const |
| Get the location of the node.
|
|
Node const * | parent () const |
| Get the parent of the node.
|
|
Node * | parent () |
|
void | mark () |
|
bool | is_marked () const |
|
virtual std::ostream & | print (std::ostream &os) const |
| Virtual function to print the node.
|
|
std::ostream & | printDot (std::ostream &os) const |
| Print the node as a dot file.
|
|
|
class | ::Joos1WLexer |
|
class | ::Joos1WParser |
|
The basic type-tagged node in the parse tree.
Definition at line 29 of file ParseTree.h.
◆ Node() [1/2]
◆ Node() [2/2]
template<typename... Args>
parsetree::Node::Node |
( |
SourceRange |
loc, |
|
|
BumpAllocator & |
alloc, |
|
|
Type |
type, |
|
|
Args &&... |
args |
|
) |
| |
|
inlineprotected |
Protected constructor for non-leaf nodes.
- Template Parameters
-
...Args | The child node types (should be Node*) |
- Parameters
-
type | The type of the node |
...args | The child nodes |
Definition at line 108 of file ParseTree.h.
111 args{
static_cast<Node**
>(alloc.allocate_bytes(
112 sizeof...(Args) *
sizeof(
Node*),
alignof(
Node*)))},
113 num_args{
sizeof...(Args)} {
114 static_assert(
sizeof...(Args) > 0,
"Must have at least one child");
115 static_assert(std::conjunction_v<std::is_convertible<Args, Node*>...>,
116 "All arguments must be convertible to Node*");
117 std::array<
Node*,
sizeof...(Args)> tmp{std::forward<Args>(args)...};
118 for(
size_t i = 0; i <
sizeof...(Args); i++) {
119 this->args[i] = tmp[i];
120 if(this->args[i] !=
nullptr) this->args[i]->parent_ =
this;
The basic type-tagged node in the parse tree.
The documentation for this struct was generated from the following files: