Commit 2b062ae9 authored by Sergio Costas's avatar Sergio Costas

Retouch of the GNU extension for designated initializer

parent e29cdea8
......@@ -686,9 +686,11 @@ initializer
initializer_list
: initializer { $$ = $1; }
| IDENTIFIER ':' initializer { $$ = $1;
$$->child1 = $3;
free_tree($2); }
| IDENTIFIER ':' initializer { $$ = $2;
$$->type = '=';
// initializer for designated initializer in struct GNU extension
$$->child1 = $1;
$$->child2 = $3; }
| designation initializer { $$ = $1;
// initializer for designated initializer in struct
$$->child2 = $2; }
......@@ -696,10 +698,12 @@ initializer_list
append_right($$,$3);
free_tree($2); }
| initializer_list ',' IDENTIFIER ':' initializer { $$ = $1;
append_right($$,$3);
$3->child1 = $5;
free_tree($2);
free_tree($4); }
append_right($$,$4);
$4->type = '=';
// initializer for designated initializer in struct GNU extension
$4->child1 = $3;
$4->child2 = $5;
free_tree($2); }
| initializer_list ',' designation initializer { $$ = $1;
append_right($$, $3);
$3->child2 = $4;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment