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
,
36 NODE_TYPE_SPECIFIER_LIST
,
45 NODE_STRUCT_OR_VARIANT_DECLARATION
,
54 * Parent node is only set on demand by specific visitor.
56 struct ctf_node
*parent
;
57 struct cds_list_head siblings
;
58 struct cds_list_head tmp_head
;
59 struct cds_list_head gc
;
67 * Children nodes are ctf_expression, typedef,
68 * typealias and type_specifier_list.
70 struct cds_list_head declaration_list
;
71 struct cds_list_head trace
;
72 struct cds_list_head stream
;
73 struct cds_list_head event
;
77 * Children nodes are ctf_expression, typedef,
78 * typealias and type_specifier_list.
80 struct cds_list_head declaration_list
;
84 * Children nodes are ctf_expression, typedef,
85 * typealias and type_specifier_list.
87 struct cds_list_head declaration_list
;
91 * Children nodes are ctf_expression, typedef,
92 * typealias and type_specifier_list.
94 struct cds_list_head declaration_list
;
97 struct cds_list_head left
; /* Should be string */
98 struct cds_list_head right
; /* Unary exp. or type */
104 UNARY_SIGNED_CONSTANT
,
105 UNARY_UNSIGNED_CONSTANT
,
111 * string for identifier, id_type, keywords,
112 * string literals and character constants.
115 int64_t signed_constant
;
116 uint64_t unsigned_constant
;
117 struct ctf_node
*sbrac_exp
;
118 struct ctf_node
*nested_exp
;
121 UNARY_LINK_UNKNOWN
= 0,
128 struct ctf_node
*type_specifier_list
;
129 struct cds_list_head type_declarators
;
131 /* new type is "alias", existing type "target" */
133 struct ctf_node
*type_specifier_list
;
134 struct cds_list_head type_declarators
;
137 struct ctf_node
*type_specifier_list
;
138 struct cds_list_head type_declarators
;
141 struct ctf_node
*target
;
142 struct ctf_node
*alias
;
146 TYPESPEC_UNKNOWN
= 0,
161 TYPESPEC_FLOATING_POINT
,
168 /* For struct, variant and enum */
169 struct ctf_node
*node
;
173 /* list of type_specifier */
174 struct cds_list_head head
;
175 } type_specifier_list
;
177 unsigned int const_qualifier
;
180 struct cds_list_head pointers
;
183 TYPEDEC_ID
, /* identifier */
184 TYPEDEC_NESTED
, /* (), array or sequence */
189 /* typedec has no pointer list */
190 struct ctf_node
*type_declarator
;
192 * unary expression (value) or
193 * type_specifier_list.
195 struct ctf_node
*length
;
196 /* for abstract type declarator */
197 unsigned int abstract_array
;
200 struct ctf_node
*bitfield_len
;
203 /* Children nodes are ctf_expression. */
204 struct cds_list_head expressions
;
207 /* Children nodes are ctf_expression. */
208 struct cds_list_head expressions
;
211 /* Children nodes are ctf_expression. */
212 struct cds_list_head expressions
;
217 * Range list or single value node. Contains unary
220 struct cds_list_head values
;
225 * Either NULL, or points to unary expression or
226 * type_specifier_list.
228 struct ctf_node
*container_type
;
229 struct cds_list_head enumerator_list
;
233 struct ctf_node
*type_specifier_list
;
234 struct cds_list_head type_declarators
;
235 } struct_or_variant_declaration
;
239 /* list of typedef, typealias and declarations */
240 struct cds_list_head declaration_list
;
245 /* list of typedef, typealias and declarations */
246 struct cds_list_head declaration_list
;
253 struct ctf_node root
;
254 struct cds_list_head allocated_nodes
;
257 const char *node_type(struct ctf_node
*node
);
261 int ctf_visitor_print_xml(FILE *fd
, int depth
, struct ctf_node
*node
);
262 int ctf_visitor_semantic_check(FILE *fd
, int depth
, struct ctf_node
*node
);
263 int ctf_visitor_parent_links(FILE *fd
, int depth
, struct ctf_node
*node
);
264 int ctf_visitor_construct_metadata(FILE *fd
, int depth
, struct ctf_node
*node
,
265 struct ctf_trace
*trace
, int byte_order
);
267 #endif /* _CTF_PARSER_H */