From a0ea96b355b1d5ac29ee1d3e4548ecd84616906b Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 9 Aug 2024 18:00:36 -0400 Subject: [PATCH] Favor use of more general idAny in parser --- src/verilog.y | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/verilog.y b/src/verilog.y index 42b7d4f4e..69b5cd078 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -1818,12 +1818,14 @@ modportPortsDecl: // // IEEE: yIMPORT modport_tf_port // // IEEE: yEXPORT modport_tf_port // // modport_tf_port expanded here - | yIMPORT id/*tf_identifier*/ { $$ = new AstModportFTaskRef{$2, *$2, false}; - GRAMMARP->m_modportImpExpActive = true; - GRAMMARP->m_modportImpExpLastIsExport = false; } - | yEXPORT id/*tf_identifier*/ { $$ = new AstModportFTaskRef{$2, *$2, true}; - GRAMMARP->m_modportImpExpActive = true; - GRAMMARP->m_modportImpExpLastIsExport = true; } + | yIMPORT idAny/*tf_identifier*/ + { $$ = new AstModportFTaskRef{$2, *$2, false}; + GRAMMARP->m_modportImpExpActive = true; + GRAMMARP->m_modportImpExpLastIsExport = false; } + | yEXPORT idAny/*tf_identifier*/ + { $$ = new AstModportFTaskRef{$2, *$2, true}; + GRAMMARP->m_modportImpExpActive = true; + GRAMMARP->m_modportImpExpLastIsExport = true; } | yIMPORT method_prototype { $$ = nullptr; BBUNSUP($1, "Unsupported: Modport import with prototype"); } | yEXPORT method_prototype @@ -2164,7 +2166,7 @@ data_typeVirtual: // ==IEEE: data_type after yVIRTUAL [ yI { AstIfaceRefDType* const ifrefp = new AstIfaceRefDType{$1, "", *$1}; ifrefp->isVirtual(true); $$ = ifrefp; } - | id/*interface*/ '.' id/*modport*/ + | id/*interface*/ '.' idAny/*modport*/ { AstIfaceRefDType* const ifrefp = new AstIfaceRefDType{$1, $3, "", *$1, *$3}; ifrefp->isVirtual(true); $$ = ifrefp; } @@ -2172,7 +2174,7 @@ data_typeVirtual: // ==IEEE: data_type after yVIRTUAL [ yI { AstIfaceRefDType* const ifrefp = new AstIfaceRefDType{$1, nullptr, "", *$1, "", $2}; ifrefp->isVirtual(true); $$ = ifrefp; } - | id/*interface*/ parameter_value_assignmentClass '.' id/*modport*/ + | id/*interface*/ parameter_value_assignmentClass '.' idAny/*modport*/ { AstIfaceRefDType* const ifrefp = new AstIfaceRefDType{$1, $4, "", *$1, *$4, $2}; ifrefp->isVirtual(true); $$ = ifrefp; } @@ -2563,22 +2565,22 @@ type_declaration: // ==IEEE: type_declaration /*cont*/ idAny variable_dimensionListE dtypeAttrListE ';' { AstNodeDType* const dtp = $2; $$ = GRAMMARP->createTypedef($3, *$3, $5, dtp, $4); } - | yTYPEDEF packageClassScope idType packed_dimensionListE + | yTYPEDEF packageClassScope idAny packed_dimensionListE /*cont*/ idAny variable_dimensionListE dtypeAttrListE ';' { AstRefDType* const refp = new AstRefDType{$3, *$3, $2, nullptr}; AstNodeDType* const dtp = GRAMMARP->createArray(refp, $4, true); $$ = GRAMMARP->createTypedef($5, *$5, $7, dtp, $6); } - | yTYPEDEF packageClassScope idType parameter_value_assignmentClass packed_dimensionListE + | yTYPEDEF packageClassScope idAny parameter_value_assignmentClass packed_dimensionListE /*cont*/ idAny variable_dimensionListE dtypeAttrListE ';' { AstRefDType* const refp = new AstRefDType{$3, *$3, $2, $4}; AstNodeDType* const dtp = GRAMMARP->createArray(refp, $5, true); $$ = GRAMMARP->createTypedef($6, *$6, $8, dtp, $7); } - | yTYPEDEF idType packed_dimensionListE + | yTYPEDEF idAny packed_dimensionListE /*cont*/ idAny variable_dimensionListE dtypeAttrListE ';' { AstRefDType* const refp = new AstRefDType{$2, *$2, nullptr, nullptr}; AstNodeDType* const dtp = GRAMMARP->createArray(refp, $3, true); $$ = GRAMMARP->createTypedef($4, *$4, $6, dtp, $5); } - | yTYPEDEF idType parameter_value_assignmentClass packed_dimensionListE + | yTYPEDEF idAny parameter_value_assignmentClass packed_dimensionListE /*cont*/ idAny variable_dimensionListE dtypeAttrListE ';' { AstRefDType* const refp = new AstRefDType{$2, *$2, nullptr, $3}; AstNodeDType* const dtp = GRAMMARP->createArray(refp, $4, true); @@ -3198,7 +3200,7 @@ instDecl: GRAMMARP->m_instParamp = nullptr); } } // // IEEE: interface_identifier' .' modport_identifier list_of_interface_identifiers - | id/*interface*/ '.' id/*modport*/ + | id/*interface*/ '.' idAny/*modport*/ /*mid*/ { VARRESET_NONLIST(VVarType::IFACEREF); AstNodeDType* const dtp = new AstIfaceRefDType{$1, $3, "", *$1, *$3}; VARDTYPE(dtp); } @@ -3897,13 +3899,13 @@ caseCondList: // IEEE: part of case_item ; patternNoExpr: // IEEE: pattern **Excluding Expr* - '.' id/*variable*/ + '.' idAny/*variable*/ { $$ = nullptr; BBUNSUP($1, "Unsupported: '{} tagged patterns"); } | yP_DOTSTAR { $$ = nullptr; BBUNSUP($1, "Unsupported: '{} tagged patterns"); } // // IEEE: "expr" excluded; expand in callers - // // "yTAGGED id [expr]" Already part of expr - //UNSUP yTAGGED id/*member_identifier*/ patternNoExpr + // // "yTAGGED idAny [expr]" Already part of expr + //UNSUP yTAGGED idAny/*member_identifier*/ patternNoExpr //UNSUP { $$ = nullptr; BBUNSUP($1, "Unsupported: '{} tagged patterns"); } // // "yP_TICKBRA patternList '}'" part of expr under assignment_pattern ; @@ -4544,7 +4546,7 @@ taskId: { $$ = new AstTask{$$, *$1, nullptr}; SYMP->pushNewUnderNodeOrCurrent($$, nullptr); } // - | id/*interface_identifier*/ '.' id + | id/*interface_identifier*/ '.' idAny { $$ = new AstTask{$$, *$3, nullptr}; BBUNSUP($2, "Unsupported: Out of block function declaration"); SYMP->pushNewUnderNodeOrCurrent($$, nullptr); } @@ -4603,7 +4605,7 @@ fIdScoped: // IEEE: part of function_body_declaration/task_ $$ = nullptr; $$ = new AstFunc{$$, *$1, nullptr, nullptr}; } // - | id/*interface_identifier*/ '.' id + | id/*interface_identifier*/ '.' idAny { $$ = $1; $$ = nullptr; $$ = new AstFunc{$$, *$1, nullptr, nullptr};