Allow any data type in primary expression
There are a few system functions that take either an expression or a data
type. This is implemented in the parser by allowing a type identifier as a
primary expression.
But those functions allow any data type, not just typedefs. E.g.
```
$bits(int);
$bits(reg [1:0]);
$bits(struct packed { int x; });
```
Support this by changing the parser rule from TYPE_IDENTIFIER to data_type.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
771d02bee1
commit
c76db2867c
8
parse.y
8
parse.y
|
|
@ -3760,12 +3760,10 @@ expr_primary_or_typename
|
||||||
|
|
||||||
/* There are a few special cases (notably $bits argument) where the
|
/* There are a few special cases (notably $bits argument) where the
|
||||||
expression may be a type name. Let the elaborator sort this out. */
|
expression may be a type name. Let the elaborator sort this out. */
|
||||||
| TYPE_IDENTIFIER
|
| data_type
|
||||||
{ pform_set_type_referenced(@1, $1.text);
|
{ PETypename*tmp = new PETypename($1);
|
||||||
PETypename*tmp = new PETypename($1.type);
|
FILE_NAME(tmp, @1);
|
||||||
FILE_NAME(tmp,@1);
|
|
||||||
$$ = tmp;
|
$$ = tmp;
|
||||||
delete[]$1.text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue