From 94cc8fb74f6a6863bb052d4b0371f277dba35e90 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sun, 5 Jul 2020 17:14:06 +0900 Subject: [PATCH] parser: Add type-name grammar type --- src/grammar.c | 13 +++++++++++++ src/grammar.h | 6 ++++++ 2 files changed, 19 insertions(+) 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 */ -- 2.47.3