Parser: Move extern decl unsupported message
This commit is contained in:
parent
67fab0b4fc
commit
583605b218
|
|
@ -2675,6 +2675,9 @@ public:
|
|||
AstNode* fvarp() const { return op1p(); }
|
||||
void addFvarp(AstNode* nodep) { addNOp1p(nodep); }
|
||||
bool isFunction() const { return fvarp() != nullptr; }
|
||||
// op2 = Class/package scope
|
||||
AstNode* packagep() const { return op2p(); }
|
||||
void packagep(AstNode* nodep) { setNOp2p(nodep); }
|
||||
// op3 = Statements/Ports/Vars
|
||||
AstNode* stmtsp() const { return op3p(); } // op3 = List of statements
|
||||
void addStmtsp(AstNode* nodep) { addNOp3p(nodep); }
|
||||
|
|
|
|||
|
|
@ -2637,6 +2637,9 @@ private:
|
|||
if (nodep->isExtern()) {
|
||||
nodep->v3warn(E_UNSUPPORTED, "Unsupported: extern class methods");
|
||||
}
|
||||
if (nodep->packagep()) {
|
||||
nodep->v3warn(E_UNSUPPORTED, "Unsupported: extern function definition");
|
||||
}
|
||||
VSymEnt* oldCurSymp = m_curSymp;
|
||||
{
|
||||
m_ftaskp = nodep;
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ struct V3ParseBisonYYSType {
|
|||
AstClass* classp;
|
||||
AstConst* constp;
|
||||
AstFork* forkp;
|
||||
AstFunc* funcp;
|
||||
AstMemberDType* memberp;
|
||||
AstNodeModule* modulep;
|
||||
AstNodeUOrStructDType* uorstructp;
|
||||
|
|
|
|||
|
|
@ -3781,33 +3781,43 @@ lifetime<lifetime>: // ==IEEE: lifetime
|
|||
;
|
||||
|
||||
taskId<ftaskp>:
|
||||
tfIdScoped
|
||||
{ $$ = new AstTask($<fl>1, *$<strp>1, nullptr);
|
||||
id
|
||||
{ $$ = new AstTask($<fl>$, *$1, nullptr);
|
||||
SYMP->pushNewUnderNodeOrCurrent($$, nullptr); }
|
||||
//
|
||||
| id/*interface_identifier*/ '.' id
|
||||
{ $$ = new AstTask($<fl>$, *$3, nullptr);
|
||||
BBUNSUP($2, "Unsupported: Out of block function declaration");
|
||||
SYMP->pushNewUnderNodeOrCurrent($$, nullptr); }
|
||||
//
|
||||
| packageClassScope id
|
||||
{ $$ = new AstTask($<fl>$, *$2, nullptr);
|
||||
$$->packagep($1);
|
||||
SYMP->pushNewUnderNodeOrCurrent($$, $<scp>1); }
|
||||
;
|
||||
|
||||
funcId<ftaskp>: // IEEE: function_data_type_or_implicit + part of function_body_declaration
|
||||
// // IEEE: function_data_type_or_implicit must be expanded here to prevent conflict
|
||||
// // function_data_type expanded here to prevent conflicts with implicit_type:empty vs data_type:ID
|
||||
/**/ tfIdScoped
|
||||
{ $$ = new AstFunc($<fl>1,*$<strp>1,nullptr,
|
||||
new AstBasicDType($<fl>1, LOGIC_IMPLICIT));
|
||||
/**/ fIdScoped
|
||||
{ $$ = $1;
|
||||
$$->addFvarp(new AstBasicDType($<fl>1, LOGIC_IMPLICIT));
|
||||
SYMP->pushNewUnderNodeOrCurrent($$, $<scp>1); }
|
||||
| signingE rangeList tfIdScoped
|
||||
{ $$ = new AstFunc($<fl>3,*$<strp>3,nullptr,
|
||||
GRAMMARP->addRange(new AstBasicDType($<fl>3, LOGIC_IMPLICIT, $1), $2,true));
|
||||
| signingE rangeList fIdScoped
|
||||
{ $$ = $3;
|
||||
$$->addFvarp(GRAMMARP->addRange(new AstBasicDType($<fl>3, LOGIC_IMPLICIT, $1), $2,true));
|
||||
SYMP->pushNewUnderNodeOrCurrent($$, $<scp>3); }
|
||||
| signing tfIdScoped
|
||||
{ $$ = new AstFunc($<fl>2,*$<strp>2,nullptr,
|
||||
new AstBasicDType($<fl>2, LOGIC_IMPLICIT, $1));
|
||||
| signing fIdScoped
|
||||
{ $$ = $2;
|
||||
$$->addFvarp(new AstBasicDType($<fl>2, LOGIC_IMPLICIT, $1));
|
||||
SYMP->pushNewUnderNodeOrCurrent($$, $<scp>2); }
|
||||
| data_type tfIdScoped
|
||||
{ $$ = new AstFunc($<fl>2,*$<strp>2,nullptr,$1);
|
||||
| data_type fIdScoped
|
||||
{ $$ = $2;
|
||||
$$->addFvarp($1);
|
||||
SYMP->pushNewUnderNodeOrCurrent($$, $<scp>2); }
|
||||
// // To verilator tasks are the same as void functions (we separately detect time passing)
|
||||
| yVOID tfIdScoped
|
||||
{ $$ = new AstTask($<fl>2, *$<strp>2, nullptr);
|
||||
SYMP->pushNewUnderNodeOrCurrent($$, $<scp>2); }
|
||||
| yVOID taskId
|
||||
{ $$ = $2; }
|
||||
;
|
||||
|
||||
funcIdNew<ftaskp>: // IEEE: from class_constructor_declaration
|
||||
|
|
@ -3821,23 +3831,29 @@ funcIdNew<ftaskp>: // IEEE: from class_constructor_declaration
|
|||
SYMP->pushNewUnder($$, nullptr); }
|
||||
| packageClassScopeNoId yNEW__PAREN
|
||||
{ $$ = new AstFunc($<fl>2, "new", nullptr, nullptr);
|
||||
BBUNSUP($<fl>2, "Unsupported: scoped new constructor");
|
||||
$$->packagep($1);
|
||||
$$->isConstructor(true);
|
||||
SYMP->pushNewUnderNodeOrCurrent($$, $<scp>1); }
|
||||
;
|
||||
|
||||
tfIdScoped<strp>: // IEEE: part of function_body_declaration/task_body_declaration
|
||||
fIdScoped<funcp>: // IEEE: part of function_body_declaration/task_body_declaration
|
||||
// // IEEE: [ interface_identifier '.' | class_scope ] function_identifier
|
||||
id
|
||||
{ $<fl>$ = $<fl>1; $<scp>$ = nullptr; $<strp>$ = $1; }
|
||||
{ $<fl>$ = $<fl>1;
|
||||
$<scp>$ = nullptr;
|
||||
$$ = new AstFunc($<fl>$, *$1, nullptr, nullptr); }
|
||||
//
|
||||
| id/*interface_identifier*/ '.' id
|
||||
{ $<fl>$ = $<fl>3; $<scp>$ = nullptr; $<strp>$ = $3;
|
||||
{ $<fl>$ = $<fl>1;
|
||||
$<scp>$ = nullptr;
|
||||
$$ = new AstFunc($<fl>$, *$1, nullptr, nullptr);
|
||||
BBUNSUP($2, "Unsupported: Out of block function declaration"); }
|
||||
//
|
||||
| packageClassScope id
|
||||
{ $<fl>$ = $<fl>2; $<scp>$ = $<scp>1; $<strp>$ = $<strp>2;
|
||||
BBUNSUP($<fl>1, "Unsupported: Out of class block function declaration"); }
|
||||
{ $<fl>$ = $<fl>1;
|
||||
$<scp>$ = $<scp>1;
|
||||
$$ = new AstFunc($<fl>$, *$2, nullptr, nullptr);
|
||||
$$->packagep($1); }
|
||||
;
|
||||
|
||||
tfGuts<nodep>:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
%Error-UNSUPPORTED: t/t_class_extern.v:11:15: Unsupported: Out of class block function declaration
|
||||
%Error-UNSUPPORTED: t/t_class_extern.v:8:24: Unsupported: extern class methods
|
||||
8 | extern function void extfunc();
|
||||
| ^~~~~~~
|
||||
%Error-UNSUPPORTED: t/t_class_extern.v:11:15: Unsupported: extern function definition
|
||||
11 | function void Cls::extfunc();
|
||||
| ^~~
|
||||
%Error: Exiting due to
|
||||
|
|
|
|||
Loading…
Reference in New Issue