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>()}
25 :
pimpl_{std::make_shared<node_number>(number)}
29 :
pimpl_{std::make_shared<node_identifier>(std::move(identifier))}
33 :
pimpl_{std::make_shared<node_assign>(identifier, number)}
37 :
pimpl_{std::make_shared<node_negate>(operand)}
47 pimpl_->print(stream, indent);
59 return pimpl_->to_string();
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.
void print(std::ostream &stream, int indent=0) const
std::string to_string() const