From 913fb34799f3fd9e737c93eeb97aa7033a3e3f0e Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Tue, 31 Oct 2017 20:26:49 +0000 Subject: [PATCH] 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. --- lexor.lex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lexor.lex b/lexor.lex index bac72dedd..3381581a7 100644 --- a/lexor.lex +++ b/lexor.lex @@ -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; }