Add support for the $unit scope identifier.

This relies on using the automatically generated name for the unit scope.
This could collide with an escaped identifier, so it would be better to
identify the scope by a reference to the PPackage object, but for now,
do it the easy way.
This commit is contained in:
Martin Whitaker 2017-10-31 20:26:49 +00:00
parent 988816c0b1
commit 913fb34799
1 changed files with 6 additions and 0 deletions

View File

@ -429,6 +429,12 @@ TU [munpf]
if (strcmp(yytext,"$attribute") == 0)
return KK_attribute;
if (gn_system_verilog() && strcmp(yytext,"$unit") == 0) {
yylval.package = pform_units.back();
return PACKAGE_IDENTIFIER;
}
yylval.text = strdupnew(yytext);
return SYSTEM_IDENTIFIER; }