Ejemplo n.º 1
0
/*
 * Set the contents of the current token
 */
bool syn_tree::set_contents(token &tok) {

	// make sure current token exists
	if(!cur)
		return false;

	// set current token contents
	cur->set_text(tok.get_text());
	cur->set_type(tok.get_type());
	return true;
}
Ejemplo n.º 2
0
/*
 * Sets the contents of the specified child token of current token
 */
bool syn_tree::set_child_contents(token &tok, unsigned int index) {

	// check to make sure child token exists
	if(!cur
			|| !get_size()
			|| index >= get_size())
		return false;

	// set contents
	token *child = cur->get_child(index);
	child->set_text(tok.get_text());
	child->set_type(tok.get_type());
	return true;
}
Ejemplo n.º 3
0
	/*
	 * Add a child token to the current token
	 */
	bool add_child(token &tok) { return add_child(tok.get_text(), tok.get_type()); }