public:
ast_type_specifier(int specifier);
+ /** Construct a type specifier from a type name */
+ ast_type_specifier(const char *name)
+ : type_specifier(ast_type_name), type_name(name), structure(NULL),
+ is_array(false), array_size(NULL), precision(ast_precision_high)
+ {
+ /* empty */
+ }
+
+ /** Construct a type specifier from a structure definition */
+ ast_type_specifier(ast_struct_specifier *s)
+ : type_specifier(ast_struct), type_name(s->name), structure(s),
+ is_array(false), array_size(NULL), precision(ast_precision_high)
+ {
+ /* empty */
+ }
+
virtual void print(void) const;
enum ast_types type_specifier;
}
| struct_specifier
{
- $$ = new ast_type_specifier(ast_struct);
- $$->structure = $1;
+ $$ = new ast_type_specifier($1);
}
| TYPE_NAME
{
- $$ = new ast_type_specifier(ast_type_name);
- $$->type_name = $1;
+ $$ = new ast_type_specifier($1);
}
;