void create_root_function_node(const iterator_t str, const iterator_t end) { /* Pop the function. */ Expr_function *root((Expr_function*)stack_inner_node.back()); stack_inner_node.pop_back(); string key; unsigned int i(stack_node.size() - 1); while (i > 0) /* The cycle searches the parameters until that finds the mark. */ { /* Parameter of function. */ Expression *child(stack_node.back()); stack_node.pop_back(); if (child->get_type_synthetized().compare("#") == 0) { delete(child); break; } root->add_child(child); string s_child(child->get_type_synthetized()); key = s_child.append(key); i--; } string s_root(root->get_function()->get_name()); key = s_root.append(key); /* Searches function. */ const Function *func(attr_grammar->get_function(key)); if (func == NULL) { cerr << "ERROR: Function non-exist: " << key << endl; exit(-1); } const Function *old(root->get_function()); root->set_function(func); /* Free aux function. */ delete(old); /* Syntetize type function. */ root->set_type_synthetized(root->get_function()->get_image()->get_name()); /* Push function in stack. */ stack_node.push_back(root); }
struct s_node *s_kid(enum s_type t, struct s_node *n) { struct s_node *r = s_new(t); return s_child(r, n); }