From 05d454a2e6e3e097857573e28ed40b95323c0ede Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Tue, 25 Dec 2007 13:54:21 +0000 Subject: [PATCH] Merry Christmas Everyone (well and I fixed parsing of initializer list entries that start with {) [r18817] --- parser.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/parser.c b/parser.c index 4af9af6..64c99cd 100644 --- a/parser.c +++ b/parser.c @@ -1081,26 +1081,26 @@ static initializer_t *parse_sub_initializer(type_t *type, had_initializer_brace_warning = false; if(token.type == '{') { - return parse_sub_initializer(type, NULL); - } - - if(expression == NULL) { - expression = parse_assignment_expression(); - - /* 6.7.8.14 + 15: we can have an optional {} around the string - * literal */ - if(read_paren && (expression->kind == EXPR_STRING_LITERAL - || expression->kind == EXPR_WIDE_STRING_LITERAL)) { - initializer_t *result - = initializer_from_expression(type, expression); - if(result != NULL) { - expect_block('}'); - return result; + sub = parse_sub_initializer(element_type, NULL); + } else { + if(expression == NULL) { + expression = parse_assignment_expression(); + + /* 6.7.8.14 + 15: we can have an optional {} around the string + * literal */ + if(read_paren && (expression->kind == EXPR_STRING_LITERAL + || expression->kind == EXPR_WIDE_STRING_LITERAL)) { + initializer_t *result + = initializer_from_expression(type, expression); + if(result != NULL) { + expect_block('}'); + return result; + } } } - } - sub = parse_sub_initializer(element_type, expression); + sub = parse_sub_initializer(element_type, expression); + } /* didn't match the subtypes -> try the parent type */ if(sub == NULL) { -- 2.20.1