tree-gen
C++ code generator for tree structures
Public Member Functions | Public Attributes | List of all members
tree_gen::NodeBuilder Class Reference

Convenience class for constructing a node. More...

Public Member Functions

 NodeBuilder (const std::string &name, const std::string &doc="")
 Construct a node with the given snake_case name and class documentation. More...
 
NodeBuilderderive_from (std::shared_ptr< Node > parent)
 Marks this node as deriving from the given node type. More...
 
NodeBuilderwith_child (EdgeType type, const std::string &node_name, const std::string &name, const std::string &doc="")
 Adds a child node. More...
 
NodeBuilderwith_prim (const std::string &prim, const std::string &name, const std::string &doc="", EdgeType type=Prim)
 Adds a child primitive. More...
 
NodeBuilderwith_order (std::list< std::string > &&order)
 Sets the order in which the parameters must appear in the dumps and constructor. More...
 
NodeBuildermark_error ()
 Indicate that this node marks a recovered parse error. More...
 

Public Attributes

std::shared_ptr< Nodenode
 The node being constructed. More...
 

Detailed Description

Convenience class for constructing a node.

Definition at line 796 of file tree-gen.hpp.

#include <tree-gen.hpp>

Constructor & Destructor Documentation

◆ NodeBuilder()

tree_gen::NodeBuilder::NodeBuilder ( const std::string &  name,
const std::string &  doc = "" 
)

Construct a node with the given snake_case name and class documentation.

Definition at line 60 of file tree-gen.cpp.

Member Function Documentation

◆ derive_from()

NodeBuilder * tree_gen::NodeBuilder::derive_from ( std::shared_ptr< Node parent)

Marks this node as deriving from the given node type.

Definition at line 79 of file tree-gen.cpp.

◆ with_child()

NodeBuilder * tree_gen::NodeBuilder::with_child ( EdgeType  type,
const std::string &  node_name,
const std::string &  name,
const std::string &  doc = "" 
)

Adds a child node.

type should be one of the edge types.

Definition at line 88 of file tree-gen.cpp.

◆ with_prim()

NodeBuilder * tree_gen::NodeBuilder::with_prim ( const std::string &  prim,
const std::string &  name,
const std::string &  doc = "",
EdgeType  type = Prim 
)

Adds a child primitive.

Definition at line 109 of file tree-gen.cpp.

◆ with_order()

NodeBuilder * tree_gen::NodeBuilder::with_order ( std::list< std::string > &&  order)

Sets the order in which the parameters must appear in the dumps and constructor.

Definition at line 146 of file tree-gen.cpp.

◆ mark_error()

NodeBuilder * tree_gen::NodeBuilder::mark_error ( )

Indicate that this node marks a recovered parse error.

Definition at line 154 of file tree-gen.cpp.

Member Data Documentation

◆ node

std::shared_ptr<Node> tree_gen::NodeBuilder::node

The node being constructed.

Definition at line 802 of file tree-gen.hpp.


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