From: Matthias Kruk Date: Sun, 5 Jul 2020 08:14:06 +0000 (+0900) Subject: parser: Add type-name grammar type X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=94cc8fb74f6a6863bb052d4b0371f277dba35e90;p=ccc parser: Add type-name grammar type --- diff --git a/src/grammar.c b/src/grammar.c index aee957f..765fde4 100644 --- a/src/grammar.c +++ b/src/grammar.c @@ -598,3 +598,16 @@ struct unary_expression *unary_expression_new(void) return(ue); } + +struct type_name *type_name_new(void) +{ + struct type_name *tn; + + tn = malloc(sizeof(*tn)); + + if(tn) { + memset(tn, 0, sizeof(*tn)); + } + + return(tn); +} diff --git a/src/grammar.h b/src/grammar.h index 3979f12..ec8fd4f 100644 --- a/src/grammar.h +++ b/src/grammar.h @@ -41,6 +41,11 @@ enum unary_expression_type { UNARY_EXPR_SIZEOF_TYPE }; +struct type_name { + struct specifier_qualifier_list *sqlist; + struct abstract_declarator *absdecl; +}; + struct unary_expression { enum unary_expression_type type; @@ -426,5 +431,6 @@ struct additive_expression *additive_expression_new(void); struct multiplicative_expression *multiplicative_expression_new(void); struct cast_expression *cast_expression_new(void); struct unary_expression *unary_expression_new(void); +struct type_name *type_name_new(void); #endif /* GRAMMAR_H */