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
30 NODE_UNARY_EXPRESSION
,
33 NODE_TYPEALIAS_TARGET
,
38 NODE_TYPE_SPECIFIER_LIST
,
47 NODE_STRUCT_OR_VARIANT_DECLARATION
,
56 * Parent node is only set on demand by specific visitor.
58 struct ctf_node
*parent
;
59 struct bt_list_head siblings
;
60 struct bt_list_head tmp_head
;
61 struct bt_list_head gc
;
69 * Children nodes are ctf_expression, typedef,
70 * typealias and type_specifier_list.
72 struct bt_list_head declaration_list
;
73 struct bt_list_head trace
;
74 struct bt_list_head env
;
75 struct bt_list_head stream
;
76 struct bt_list_head event
;
77 struct bt_list_head clock
;
81 * Children nodes are ctf_expression, typedef,
82 * typealias and type_specifier_list.
84 struct bt_list_head declaration_list
;
88 * Children nodes are ctf_expression, typedef,
89 * typealias and type_specifier_list.
91 struct bt_list_head declaration_list
;
95 * Children nodes are ctf_expression, typedef,
96 * typealias and type_specifier_list.
98 struct bt_list_head declaration_list
;
102 * Children nodes are ctf_expression, typedef,
103 * typealias and type_specifier_list.
105 struct bt_list_head declaration_list
;
109 * Children nodes are ctf_expression, typedef,
110 * typealias and type_specifier_list.
112 struct bt_list_head declaration_list
;
115 struct bt_list_head left
; /* Should be string */
116 struct bt_list_head right
; /* Unary exp. or type */
122 UNARY_SIGNED_CONSTANT
,
123 UNARY_UNSIGNED_CONSTANT
,
129 * string for identifier, id_type, keywords,
130 * string literals and character constants.
133 int64_t signed_constant
;
134 uint64_t unsigned_constant
;
135 struct ctf_node
*sbrac_exp
;
136 struct ctf_node
*nested_exp
;
139 UNARY_LINK_UNKNOWN
= 0,
146 struct ctf_node
*type_specifier_list
;
147 struct bt_list_head type_declarators
;
149 /* new type is "alias", existing type "target" */
151 struct ctf_node
*type_specifier_list
;
152 struct bt_list_head type_declarators
;
155 struct ctf_node
*type_specifier_list
;
156 struct bt_list_head type_declarators
;
159 struct ctf_node
*target
;
160 struct ctf_node
*alias
;
164 TYPESPEC_UNKNOWN
= 0,
179 TYPESPEC_FLOATING_POINT
,
186 /* For struct, variant and enum */
187 struct ctf_node
*node
;
191 /* list of type_specifier */
192 struct bt_list_head head
;
193 } type_specifier_list
;
195 unsigned int const_qualifier
;
198 struct bt_list_head pointers
;
201 TYPEDEC_ID
, /* identifier */
202 TYPEDEC_NESTED
, /* (), array or sequence */
207 /* typedec has no pointer list */
208 struct ctf_node
*type_declarator
;
210 * unary expression (value) or
211 * type_specifier_list.
213 struct bt_list_head length
;
214 /* for abstract type declarator */
215 unsigned int abstract_array
;
218 struct ctf_node
*bitfield_len
;
221 /* Children nodes are ctf_expression. */
222 struct bt_list_head expressions
;
225 /* Children nodes are ctf_expression. */
226 struct bt_list_head expressions
;
229 /* Children nodes are ctf_expression. */
230 struct bt_list_head expressions
;
235 * Range list or single value node. Contains unary
238 struct bt_list_head values
;
243 * Either NULL, or points to unary expression or
244 * type_specifier_list.
246 struct ctf_node
*container_type
;
247 struct bt_list_head enumerator_list
;
251 struct ctf_node
*type_specifier_list
;
252 struct bt_list_head type_declarators
;
253 } struct_or_variant_declaration
;
257 /* list of typedef, typealias and declarations */
258 struct bt_list_head declaration_list
;
263 /* list of typedef, typealias and declarations */
264 struct bt_list_head declaration_list
;
266 struct bt_list_head min_align
; /* align() attribute */
272 struct ctf_node root
;
273 struct bt_list_head allocated_nodes
;
276 const char *node_type(struct ctf_node
*node
);
280 int ctf_visitor_print_xml(FILE *fd
, int depth
, struct ctf_node
*node
);
281 int ctf_visitor_semantic_check(FILE *fd
, int depth
, struct ctf_node
*node
);
282 int ctf_visitor_parent_links(FILE *fd
, int depth
, struct ctf_node
*node
);
283 int ctf_visitor_construct_metadata(FILE *fd
, int depth
, struct ctf_node
*node
,
284 struct ctf_trace
*trace
, int byte_order
);
286 #endif /* _CTF_PARSER_H */