12 return std::make_shared<node_add>(left, right);
14 return std::make_shared<node_subtract>(left, right);
16 return std::make_shared<node_multiply>(left, right);
18 return std::make_shared<node_divide>(left, right);
20 throw calc_error{
"fatal error in make_binary_opreator: unknown operator: " + std::string(1,op)};
24 : pimpl_{std::make_shared<node_void>()}
32 : pimpl_{std::make_shared<node_number>(
number{x})}
44 :
pimpl_{std::make_shared<node_number>(num)}
48 :
pimpl_{std::make_shared<node_identifier>(std::move(identifier))}
52 :
pimpl_{std::make_shared<node_negate>(operand)}
60 : pimpl_{std::make_shared<node_function>(std::move(parameters), definition)}
64 :
pimpl_{std::make_shared<node_function_call>(std::move(name), std::move(arguments))}
70 pimpl_->print(stream, indent);
82 return pimpl_->to_string();
88 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).
static std::shared_ptr< node_impl > read_node(std::istream &stream)
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.
void save(std::ostream &stream) const