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
29 NODE_UNARY_EXPRESSION
,
32 NODE_TYPEALIAS_TARGET
,
37 NODE_TYPE_SPECIFIER_LIST
,
46 NODE_STRUCT_OR_VARIANT_DECLARATION
,
55 * Parent node is only set on demand by specific visitor.
57 struct ctf_node
*parent
;
58 struct cds_list_head siblings
;
59 struct cds_list_head tmp_head
;
60 struct cds_list_head gc
;
68 * Children nodes are ctf_expression, typedef,
69 * typealias and type_specifier_list.
71 struct cds_list_head declaration_list
;
72 struct cds_list_head trace
;
73 struct cds_list_head stream
;
74 struct cds_list_head event
;
75 struct cds_list_head clock
;
79 * Children nodes are ctf_expression, typedef,
80 * typealias and type_specifier_list.
82 struct cds_list_head declaration_list
;
86 * Children nodes are ctf_expression, typedef,
87 * typealias and type_specifier_list.
89 struct cds_list_head declaration_list
;
93 * Children nodes are ctf_expression, typedef,
94 * typealias and type_specifier_list.
96 struct cds_list_head declaration_list
;
100 * Children nodes are ctf_expression, typedef,
101 * typealias and type_specifier_list.
103 struct cds_list_head declaration_list
;
106 struct cds_list_head left
; /* Should be string */
107 struct cds_list_head right
; /* Unary exp. or type */
113 UNARY_SIGNED_CONSTANT
,
114 UNARY_UNSIGNED_CONSTANT
,
120 * string for identifier, id_type, keywords,
121 * string literals and character constants.
124 int64_t signed_constant
;
125 uint64_t unsigned_constant
;
126 struct ctf_node
*sbrac_exp
;
127 struct ctf_node
*nested_exp
;
130 UNARY_LINK_UNKNOWN
= 0,
137 struct ctf_node
*type_specifier_list
;
138 struct cds_list_head type_declarators
;
140 /* new type is "alias", existing type "target" */
142 struct ctf_node
*type_specifier_list
;
143 struct cds_list_head type_declarators
;
146 struct ctf_node
*type_specifier_list
;
147 struct cds_list_head type_declarators
;
150 struct ctf_node
*target
;
151 struct ctf_node
*alias
;
155 TYPESPEC_UNKNOWN
= 0,
170 TYPESPEC_FLOATING_POINT
,
177 /* For struct, variant and enum */
178 struct ctf_node
*node
;
182 /* list of type_specifier */
183 struct cds_list_head head
;
184 } type_specifier_list
;
186 unsigned int const_qualifier
;
189 struct cds_list_head pointers
;
192 TYPEDEC_ID
, /* identifier */
193 TYPEDEC_NESTED
, /* (), array or sequence */
198 /* typedec has no pointer list */
199 struct ctf_node
*type_declarator
;
201 * unary expression (value) or
202 * type_specifier_list.
204 struct cds_list_head length
;
205 /* for abstract type declarator */
206 unsigned int abstract_array
;
209 struct ctf_node
*bitfield_len
;
212 /* Children nodes are ctf_expression. */
213 struct cds_list_head expressions
;
216 /* Children nodes are ctf_expression. */
217 struct cds_list_head expressions
;
220 /* Children nodes are ctf_expression. */
221 struct cds_list_head expressions
;
226 * Range list or single value node. Contains unary
229 struct cds_list_head values
;
234 * Either NULL, or points to unary expression or
235 * type_specifier_list.
237 struct ctf_node
*container_type
;
238 struct cds_list_head enumerator_list
;
242 struct ctf_node
*type_specifier_list
;
243 struct cds_list_head type_declarators
;
244 } struct_or_variant_declaration
;
248 /* list of typedef, typealias and declarations */
249 struct cds_list_head declaration_list
;
254 /* list of typedef, typealias and declarations */
255 struct cds_list_head declaration_list
;
257 struct cds_list_head min_align
; /* align() attribute */
263 struct ctf_node root
;
264 struct cds_list_head allocated_nodes
;
267 const char *node_type(struct ctf_node
*node
);
271 int ctf_visitor_print_xml(FILE *fd
, int depth
, struct ctf_node
*node
);
272 int ctf_visitor_semantic_check(FILE *fd
, int depth
, struct ctf_node
*node
);
273 int ctf_visitor_parent_links(FILE *fd
, int depth
, struct ctf_node
*node
);
274 int ctf_visitor_construct_metadata(FILE *fd
, int depth
, struct ctf_node
*node
,
275 struct ctf_trace
*trace
, int byte_order
);
277 #endif /* _CTF_PARSER_H */