Add min_typ_max to expressions.

This patch adds min_typ_max to expressions. Remember when using a
min_typ_max triplet in an expression they must be enclosed with
parenthesis (1364-2001 section 4.3 page 58).
This commit is contained in:
Cary R 2007-09-16 08:25:03 -07:00 committed by Stephen Williams
parent 2e12dee658
commit 954579f250
1 changed files with 26 additions and 2 deletions

28
parse.y
View File

@ -217,7 +217,7 @@ static list<perm_string>* list_from_identifier(list<perm_string>*tmp, char*id)
%type <gates> gate_instance_list
%type <pform_name> heirarchy_identifier
%type <expr> expression expr_primary
%type <expr> expression expr_primary expr_mintypmax
%type <expr> lpvalue
%type <expr> delay_value delay_value_simple
%type <exprs> delay1 delay3 delay3_opt delay_value_list
@ -953,6 +953,30 @@ expression
}
;
expr_mintypmax
: expression
{ $$ = $1; }
| expression ':' expression ':' expression
{ switch (min_typ_max_flag) {
case MIN:
$$ = $1;
delete $3;
delete $5;
break;
case TYP:
delete $1;
$$ = $3;
delete $5;
break;
case MAX:
delete $1;
delete $3;
$$ = $5;
break;
}
}
;
/* Many contexts take a comma separated list of expressions. Null
expressions can happen anywhere in the list, so there are two
@ -1060,7 +1084,7 @@ expr_primary
/* Parenthesized expressions are primaries. */
| '(' expression ')'
| '(' expr_mintypmax ')'
{ $$ = $2; }
/* Various kinds of concatenation expressions. */