Allows multiple attribute instances.

This patch adds the ability to have multiple attribute instances
(e.g. (* foo = 1 *) (* bar = 2 *)).
This commit is contained in:
Cary R 2011-02-24 17:37:56 -08:00 committed by Stephen Williams
parent c90a896448
commit 468fd3d683
1 changed files with 16 additions and 3 deletions

19
parse.y
View File

@ -426,7 +426,7 @@ static list<named_pexpr_t>* make_named_number(perm_string name, PExpr*val =0)
%type <named_pexprs> port_name_list parameter_value_byname_list
%type <named_pexpr> attribute
%type <named_pexprs> attribute_list attribute_list_opt
%type <named_pexprs> attribute_list attribute_instance_list attribute_list_opt
%type <citem> case_item
%type <citems> case_items
@ -522,11 +522,24 @@ real_or_realtime
variety of different objects. The syntax inside the (* *) is a
comma separated list of names or names with assigned values. */
attribute_list_opt
: K_PSTAR attribute_list K_STARP { $$ = $2; }
| K_PSTAR K_STARP { $$ = 0; }
: attribute_instance_list
| { $$ = 0; }
;
attribute_instance_list
: K_PSTAR K_STARP { $$ = 0; }
| K_PSTAR attribute_list K_STARP { $$ = $2; }
| attribute_instance_list K_PSTAR K_STARP { $$ = $1; }
| attribute_instance_list K_PSTAR attribute_list K_STARP
{ list<named_pexpr_t>*tmp = $1;
if (tmp) {
tmp->splice(tmp->end(), *$3);
delete $3;
$$ = tmp;
} else $$ = $3;
}
;
attribute_list
: attribute_list ',' attribute
{ list<named_pexpr_t>*tmp = $1;