7 #include <babeltrace/list.h>
9 // the parameter name (of the reentrant 'yyparse' function)
10 // data is a pointer to a 'SParserParam' structure
11 //#define YYPARSE_PARAM scanner
13 // the argument for the 'yylex' function
14 #define YYLEX_PARAM ((struct ctf_scanner *) scanner)->scanner
28 NODE_UNARY_EXPRESSION
,
31 NODE_TYPEALIAS_TARGET
,
44 NODE_STRUCT_OR_VARIANT_DECLARATION
,
53 * Parent node is only set on demand by specific visitor.
55 struct ctf_node
*parent
;
56 struct cds_list_head siblings
;
57 struct cds_list_head tmp_head
;
58 struct cds_list_head gc
;
65 struct cds_list_head _typedef
;
66 struct cds_list_head typealias
;
67 struct cds_list_head declaration_specifier
;
68 struct cds_list_head trace
;
69 struct cds_list_head stream
;
70 struct cds_list_head event
;
74 * Children nodes are ctf_expression, typedef,
75 * typealias and declaration specifiers.
77 struct cds_list_head declaration_list
;
81 * Children nodes are ctf_expression, typedef,
82 * typealias and declaration specifiers.
84 struct cds_list_head declaration_list
;
88 * Children nodes are ctf_expression, typedef,
89 * typealias and declaration specifiers.
91 struct cds_list_head declaration_list
;
94 struct cds_list_head left
; /* Should be string */
95 struct cds_list_head right
; /* Unary exp. or type */
101 UNARY_SIGNED_CONSTANT
,
102 UNARY_UNSIGNED_CONSTANT
,
108 * string for identifier, id_type, keywords,
109 * string literals and character constants.
112 int64_t signed_constant
;
113 uint64_t unsigned_constant
;
114 struct ctf_node
*sbrac_exp
;
115 struct ctf_node
*nested_exp
;
118 UNARY_LINK_UNKNOWN
= 0,
125 struct cds_list_head declaration_specifier
;
126 struct cds_list_head type_declarators
;
128 /* new type is "alias", existing type "target" */
130 struct cds_list_head declaration_specifier
;
131 struct cds_list_head type_declarators
;
134 struct cds_list_head declaration_specifier
;
135 struct cds_list_head type_declarators
;
138 struct ctf_node
*target
;
139 struct ctf_node
*alias
;
143 TYPESPEC_UNKNOWN
= 0,
162 unsigned int const_qualifier
;
165 struct cds_list_head pointers
;
168 TYPEDEC_ID
, /* identifier */
169 TYPEDEC_NESTED
, /* (), array or sequence */
174 /* typedec has no pointer list */
175 struct ctf_node
*type_declarator
;
176 /* value or first node of declaration specifier list */
177 struct ctf_node
*length
;
178 /* for abstract type declarator */
179 unsigned int abstract_array
;
182 struct ctf_node
*bitfield_len
;
185 /* Children nodes are ctf_expression. */
186 struct cds_list_head expressions
;
189 /* Children nodes are ctf_expression. */
190 struct cds_list_head expressions
;
193 /* Children nodes are ctf_expression. */
194 struct cds_list_head expressions
;
199 * Range list or single value node. Contains unary
202 struct cds_list_head values
;
206 /* NULL, value or declaration specifier */
207 struct ctf_node
*container_type
;
208 struct cds_list_head enumerator_list
;
212 struct cds_list_head declaration_specifier
;
213 struct cds_list_head type_declarators
;
214 } struct_or_variant_declaration
;
218 /* list of typedef, typealias and declarations */
219 struct cds_list_head declaration_list
;
224 /* list of typedef, typealias and declarations */
225 struct cds_list_head declaration_list
;
232 struct ctf_node root
;
233 struct cds_list_head allocated_nodes
;
236 const char *node_type(struct ctf_node
*node
);
238 int ctf_visitor_print_xml(FILE *fd
, int depth
, struct ctf_node
*node
);
239 int ctf_visitor_semantic_check(FILE *fd
, int depth
, struct ctf_node
*node
);
240 int ctf_visitor_parent_links(FILE *fd
, int depth
, struct ctf_node
*node
);
242 #endif /* _CTF_PARSER_H */