Ejemplo n.º 1
0
/*
 * Returns the contents of the lexer as a token
 */
bool lexer::get_token(token &tok) {

	// set appropriate values
	tok.set_text(text);
	tok.set_type(type);
	return true;
}
Ejemplo n.º 2
0
/*
 * Returns the contents at the root
 */
bool syn_tree::get_root_contents(token &tok) {

	// check that root token exists
	if(!root)
		return false;

	// set the text & type
	tok.set_text(root->get_text());
	tok.set_type(root->get_type());
	return true;
}
Ejemplo n.º 3
0
/*
 * Returns contents at current token
 */
bool syn_tree::get_contents(token &tok) {

	// check that current token exists
	if(!cur)
		return false;

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

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

	// retrieve contents
	token *child = cur->get_child(index);
	tok.set_text(child->get_text());
	tok.set_type(child->get_type());
	return true;
}