From 468fd3d6839b988f23a3c8fd7051cf6f03e438e9 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 24 Feb 2011 17:37:56 -0800 Subject: [PATCH] Allows multiple attribute instances. This patch adds the ability to have multiple attribute instances (e.g. (* foo = 1 *) (* bar = 2 *)). --- parse.y | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/parse.y b/parse.y index 9ad2c3e4f..75ff5b473 100644 --- a/parse.y +++ b/parse.y @@ -426,7 +426,7 @@ static list* make_named_number(perm_string name, PExpr*val =0) %type port_name_list parameter_value_byname_list %type attribute -%type attribute_list attribute_list_opt +%type attribute_list attribute_instance_list attribute_list_opt %type case_item %type 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*tmp = $1; + if (tmp) { + tmp->splice(tmp->end(), *$3); + delete $3; + $$ = tmp; + } else $$ = $3; + } + ; + attribute_list : attribute_list ',' attribute { list*tmp = $1;