11 return std::make_shared<node_add>(left, right);
13 return std::make_shared<node_subtract>(left, right);
15 return std::make_shared<node_multiply>(left, right);
17 return std::make_shared<node_divide>(left, right);
19 throw calc_error{
"fatal error in make_binary_opreator: unknown operator: " + std::string(1,op)};
23 : pimpl_{std::make_shared<node_void>()}
31 : pimpl_{std::make_shared<node_number>(number)}
35 :
pimpl_{std::make_shared<node_identifier>(identifier)}
39 :
pimpl_{std::make_shared<node_negate>(operand)}
47 : pimpl_{std::make_shared<node_function>(parameters, definition)}
51 :
pimpl_{std::make_shared<node_function_call>(name, arguments)}
57 pimpl_->print(stream, indent);
69 return pimpl_->to_string();
75 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