V0.9: 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 18:16:32 -08:00 committed by Stephen Williams
parent cedee1137e
commit 8de917347e
1 changed files with 17 additions and 3 deletions

20
parse.y
View File

@ -323,7 +323,7 @@ static PECallFunction*make_call_function(perm_string tn, PExpr*arg1, PExpr*arg2)
%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
@ -417,11 +417,25 @@ 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
{ if ($1) {
svector<named_pexpr_t*>*tmp;
tmp = new svector<named_pexpr_t*>(*$1, *$3);
delete $1;
delete $3;
$$ = tmp;
} else $$ = $3;
}
;
attribute_list
: attribute_list ',' attribute
{ svector<named_pexpr_t*>*tmp =