9 return std::make_shared<node_add>(left, right);
11 return std::make_shared<node_subtract>(left, right);
13 return std::make_shared<node_multiply>(left, right);
15 return std::make_shared<node_divide>(left, right);
17 throw std::logic_error{
"fatal error in make_binary_opreator: unknown operator: " + std::string(1,op)};
21 : pimpl_{std::make_shared<node_void>()}
28 :
pimpl_{std::make_shared<node_number>(number)}
32 :
pimpl_{std::make_shared<node_identifier>(std::move(identifier))}
36 :
pimpl_{std::make_shared<node_negate>(operand)}
44 : pimpl_{std::make_shared<node_function>(std::move(parameters), definition)}
48 :
pimpl_{std::make_shared<node_function_call>(std::move(name), arguments)}
54 pimpl_->print(stream, indent);
66 return pimpl_->to_string();
72 return pimpl_->get_parameters();
std::shared_ptr< node_impl > pimpl_
static std::shared_ptr< node_impl > make_binary_operator(node, char, node)
Factory function to make the binary operator nodes.
std::vector< std::string > identifier_list
A sequence of identifiers (e.g., parameter names).
void print(std::ostream &stream, int indent=0) const
std::string to_string() const
identifier_list const & get_parameters() const
std::vector< node > node_list
A sequence of nodes.