Support package names shadowing type identifiers
SystemVerilog allows a package declaration to use a name that is also visible
as a type identifier. The lexer reports such names as `TYPE_IDENTIFIER` before
the package has been installed, which made constructs such as:
package p;
typedef int T;
endpackage
import p::*;
package T;
endpackage
fail in the package declaration grammar.
Package declarations do not have the local type/name ambiguity that exists for
variable, net, or parameter declarations. After the optional lifetime the next
token is always the package name. Use `identifier_name` so a
`TYPE_IDENTIFIER` token can be accepted as the package name.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
2cef311be2
commit
ca5c6fc59f
2
parse.y
2
parse.y
|
|
@ -2359,7 +2359,7 @@ open_range_list /* IEEE1800-2005 A.2.11 */
|
|||
;
|
||||
|
||||
package_declaration /* IEEE1800-2005 A.1.2 */
|
||||
: K_package lifetime_opt IDENTIFIER ';'
|
||||
: K_package lifetime_opt identifier_name ';'
|
||||
{ pform_start_package_declaration(@1, $3, $2); }
|
||||
timeunits_declaration_opt
|
||||
{ pform_set_scope_timescale(@1); }
|
||||
|
|
|
|||
Loading…
Reference in New Issue