int cil_gen_bounds(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node, enum cil_flavor flavor)
{
	enum cil_syntax syntax[] = {
		CIL_SYN_STRING,
		CIL_SYN_STRING,
		CIL_SYN_STRING,
		CIL_SYN_END
	};
	int syntax_len = sizeof(syntax)/sizeof(*syntax);
	struct cil_bounds *bounds = NULL;
	int rc = SEPOL_ERR;

	if (db == NULL || parse_current == NULL || ast_node == NULL) {
		goto exit;
	}

	rc = __cil_verify_syntax(parse_current, syntax, syntax_len);
	if (rc != SEPOL_OK) {
		goto exit;
	}

	cil_bounds_init(&bounds);

	bounds->parent_str = parse_current->next->data;
	bounds->child_str = parse_current->next->next->data;

	ast_node->data = bounds;

	switch (flavor) {
	case CIL_USER:
		ast_node->flavor = CIL_USERBOUNDS;
		break;
	case CIL_ROLE:
		ast_node->flavor = CIL_ROLEBOUNDS;
		break;
	case CIL_TYPE:
		ast_node->flavor = CIL_TYPEBOUNDS;
		break;
	default:
		break;
	}

	return SEPOL_OK;

exit:
	cil_tree_log(parse_current, CIL_ERR, "Bad bounds declaration");
	cil_destroy_bounds(bounds);
	return rc;
}
int cil_gen_bounds(struct cil_db *db, struct cil_tree_node *parse_current, struct cil_tree_node *ast_node, enum cil_flavor flavor)
{
	enum cil_syntax syntax[] = {
		CIL_SYN_STRING,
		CIL_SYN_STRING,
		CIL_SYN_STRING,
		CIL_SYN_END
	};
	int syntax_len = sizeof(syntax)/sizeof(*syntax);
	struct cil_bounds *bounds = NULL;
	int rc = SEPOL_ERR;

	if (db == NULL || parse_current == NULL || ast_node == NULL) {
		goto exit;
	}

	rc = __cil_verify_syntax(parse_current, syntax, syntax_len);
	if (rc != SEPOL_OK) {
		goto exit;
	}

	cil_bounds_init(&bounds);

	bounds->parent_str = parse_current->next->data;
	bounds->child_str = parse_current->next->next->data;

	ast_node->data = bounds;

	switch (flavor) {
	case CIL_USER:
		ast_node->flavor = CIL_USERBOUNDS;
		break;
	case CIL_ROLE:
		ast_node->flavor = CIL_ROLEBOUNDS;
		break;
	case CIL_TYPE:
		ast_node->flavor = CIL_TYPEBOUNDS;
		break;
	default:
		break;
	}

	return SEPOL_OK;

exit:
	cil_tree_log(parse_current, CIL_ERR, "Bad bounds declaration");
	cil_destroy_bounds(bounds);
	return rc;
}