Allow a UDP instance to have a simple real delay.

The parser does not distinguish between module and UDP instances, so
a UDP delay is handled by the rules used for parsing module parameter
overrides. Although these rules had been relaxed to accept the case of
a simple decimal value (e.g. #10), they did not allow a simple real
value (e.g. #0.1).
This commit is contained in:
Martin Whitaker 2012-07-17 23:54:02 +01:00 committed by Stephen Williams
parent befff82655
commit a5a512758e
1 changed files with 14 additions and 1 deletions

15
parse.y
View File

@ -4518,7 +4518,9 @@ from_exclude : K_from { $$ = false; } | K_exclude { $$ = true; } ;
Although the BNF in IEEE1364-1995 implies that parameter value Although the BNF in IEEE1364-1995 implies that parameter value
lists must be in parentheses, in practice most compilers will lists must be in parentheses, in practice most compilers will
accept simple expressions outside of parentheses if there is only accept simple expressions outside of parentheses if there is only
one value, so I'll accept simple numbers here. one value, so I'll accept simple numbers here. This also catches
the case of a UDP with a single delay value, so we need to accept
real values as well as decimal ones.
The parameter value by name syntax is OVI enhancement BTF-B06 as The parameter value by name syntax is OVI enhancement BTF-B06 as
approved by WG1364 on 6/28/1998. */ approved by WG1364 on 6/28/1998. */
@ -4548,6 +4550,17 @@ parameter_value_opt
$$ = lst; $$ = lst;
based_size = 0; based_size = 0;
} }
| '#' REALTIME
{ assert($2);
PEFNumber*tmp = new PEFNumber($2);
FILE_NAME(tmp, @1);
struct parmvalue_t*lst = new struct parmvalue_t;
lst->by_order = new list<PExpr*>;
lst->by_order->push_back(tmp);
lst->by_name = 0;
$$ = lst;
}
| '#' error | '#' error
{ yyerror(@1, "error: syntax error in parameter value " { yyerror(@1, "error: syntax error in parameter value "
"assignment list."); "assignment list.");