Skip to content

Commit

Permalink
Add min_typ_max to expressions.
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
caryr authored and steveicarus committed Sep 17, 2007
1 parent 2e12dee commit 954579f
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1060,7 +1084,7 @@ expr_primary

/* Parenthesized expressions are primaries. */

| '(' expression ')'
| '(' expr_mintypmax ')'
{ $$ = $2; }

/* Various kinds of concatenation expressions. */
Expand Down

0 comments on commit 954579f

Please sign in to comment.