TaPAS
0.2
|
A generic parse tree. More...
Go to the source code of this file.
Data Structures | |
union | ccl_parse_tree_value_union |
Possible values that can decorate a node. More... | |
struct | ccl_parse_tree_st |
Structure encoding of a parse-tree node. More... | |
Typedefs | |
typedef union ccl_parse_tree_value_union | ccl_parse_tree_value |
Possible values that can decorate a node. | |
typedef enum ccl_parse_tree_value_type_enum | ccl_parse_tree_value_type |
Enum that indicates the kind of data that decorates a node. | |
typedef struct ccl_parse_tree_st | ccl_parse_tree |
Type of a parse-tree node. | |
Enumerations | |
enum | ccl_parse_tree_value_type_enum { CCL_PARSE_TREE_INT, CCL_PARSE_TREE_FLOAT, CCL_PARSE_TREE_STRING, CCL_PARSE_TREE_IDENT, CCL_PARSE_TREE_EMPTY } |
Enum that indicates the kind of data that decorates a node. More... | |
Functions | |
ccl_parse_tree * | ccl_parse_tree_create (int type, const char *type_string, ccl_parse_tree_value_type vtype, int line, const char *filename, ccl_parse_tree *child, ccl_parse_tree *next, ccl_parse_tree *container) |
Creates a new node. More... | |
int | ccl_parse_tree_count_siblings (ccl_parse_tree *t) |
Returns the number of siblings of the node t. More... | |
void | ccl_parse_tree_delete_node (ccl_parse_tree *t) |
Deletes the node t. More... | |
void | ccl_parse_tree_delete_tree (ccl_parse_tree *t) |
Deletes the tree t and its siblings. More... | |
void | ccl_parse_tree_delete_container (ccl_parse_tree *t) |
Deletes the nodes in the list t. More... | |
ccl_parse_tree * | ccl_parse_tree_reverse_siblings (ccl_parse_tree *t) |
Reverses the list of siblings starting at the node t. More... | |
ccl_parse_tree * | ccl_parse_tree_duplicate (ccl_parse_tree *t, ccl_parse_tree **cont) |
Duplicate the tree t. More... | |
A generic parse tree.
Definition in file ccl-parse-tree.h.
Enum that indicates the kind of data that decorates a node.
Enumerator | |
---|---|
CCL_PARSE_TREE_INT |
An integer value stored in the int_value field of a ccl_parse_tree_value. |
CCL_PARSE_TREE_FLOAT |
A floating-point value stored in the flt_value field of a ccl_parse_tree_value. |
CCL_PARSE_TREE_STRING |
A string value stored in the string_value field of a ccl_parse_tree_value. |
CCL_PARSE_TREE_IDENT |
An indentifier value stored in the id_value field of a ccl_parse_tree_value. |
CCL_PARSE_TREE_EMPTY |
No data is attached to the node. |
Definition at line 63 of file ccl-parse-tree.h.
int ccl_parse_tree_count_siblings | ( | ccl_parse_tree * | t | ) |
Returns the number of siblings of the node t.
t | the node to explore |
ccl_parse_tree* ccl_parse_tree_create | ( | int | type, |
const char * | type_string, | ||
ccl_parse_tree_value_type | vtype, | ||
int | line, | ||
const char * | filename, | ||
ccl_parse_tree * | child, | ||
ccl_parse_tree * | next, | ||
ccl_parse_tree * | container | ||
) |
Creates a new node.
type | identifier of the kind of node (field node_type) |
type_string | a human readable string describing type (field node_type_string) |
vtype | kind of value stored in this node (field value_type) |
line | start line of the sub-tree (field line) |
filename | name of the file from which comes the node (field filename) |
child | pointer to the first child node (field child) |
next | pointer to the first sibling (field next) |
container | pointer to the next node in the list of created nodes (field next_in_container) |
void ccl_parse_tree_delete_container | ( | ccl_parse_tree * | t | ) |
Deletes the nodes in the list t.
The function deletes the list starting at t following the chaining made with the next_in_container field.
t | the tree |
void ccl_parse_tree_delete_node | ( | ccl_parse_tree * | t | ) |
Deletes the node t.
The function releases the resources allocated to the node t. Sub-trees and siblings are not deleted. Attached values are deleted according to their value_type.
t | the node to delete |
void ccl_parse_tree_delete_tree | ( | ccl_parse_tree * | t | ) |
Deletes the tree t and its siblings.
The function deletes the tree pointed by t and deletes the siblings of t following the next chaining.
t | the tree to delete |
ccl_parse_tree* ccl_parse_tree_duplicate | ( | ccl_parse_tree * | t, |
ccl_parse_tree ** | cont | ||
) |
Duplicate the tree t.
The function duplicates the tree t and its sub-tree. Each value field is duplicated according to its kind of value. The filename is also duplicated but as a ccl_ustring.
If cont is not NULL then each newly created node is chained with *cont using the next_in_container field of t.
t | the tree to duplicate |
cont | the address of a container list |
ccl_parse_tree* ccl_parse_tree_reverse_siblings | ( | ccl_parse_tree * | t | ) |
Reverses the list of siblings starting at the node t.
The function reverses the list starting a t following the chaining made with the next field.
t | the tree |