示例#1
0
 void attach( expr_ptr const &a, std::deque<expression_type> &operator_deq, std::deque<expr_ptr> &children_deq )
 {
     for( size_t i = 0; i != a->num_children(); ++i ){
         expression_type type_of_expr = a->get_children( i )->get_type();
         if( type_of_expr == expression_type::Plus ){
             operator_deq.push_back( type_of_expr );
             attach( a->get_children( i ), operator_deq, children_deq );
         } else {
             children_deq.push_back( a->get_children( i ) );
         }
     }
 }
示例#2
0
 expr_ptr build_rightmost_tree( expr_ptr const &a, expr_ptr &node, expression_type in )
 {
     expr_ptr right_tree = build_tree_for( in );
     right_tree->set_children( 1, a );
 
     right_tree.swap( node );
 
     node->set_children( 0, right_tree );
     return node->get_children( 1 );
 }