Internals: Reorganize system function/task parse rules. No functional change.

This commit is contained in:
Wilson Snyder 2025-12-13 21:34:28 -05:00
parent 5634795140
commit 27558c9349
1 changed files with 20 additions and 16 deletions

View File

@ -3583,11 +3583,17 @@ statement_item<nodeStmtp>: // IEEE: statement_item
newfl->warnOff(V3ErrorCode::IGNOREDRETURN, true);
$6->fileline(newfl);
$$ = exprp->makeStmt(); }
| yVOID yP_TICK '(' system_t_call ')' ';'
| yVOID yP_TICK '(' system_t_stmt_call ')' ';'
{ $$ = $4;
FileLine* const newfl = new FileLine{$$->fileline()};
newfl->warnOff(V3ErrorCode::IGNOREDRETURN, true);
$$->fileline(newfl); }
// // Any system function as a task
| yVOID yP_TICK '(' system_f_or_t_expr_call ')' ';'
{ $$ = new AstStmtExpr{$<fl>4, $4};
FileLine* const newfl = new FileLine{$$->fileline()};
newfl->warnOff(V3ErrorCode::IGNOREDRETURN, true);
$$->fileline(newfl); }
//
| task_subroutine_callNoSemi ';' { $$ = $1; }
//
@ -4064,7 +4070,9 @@ task_subroutine_callNoSemi<nodeStmtp>: // similar to IEEE task_subroutine_call
// // Expr here must result in a subroutine_call
task_subroutine_callNoMethod { $$ = $1->makeStmt(); }
| fexpr '.' task_subroutine_callNoMethod { $$ = (new AstDot{$<fl>2, false, $1, $3})->makeStmt(); }
| system_t_call { $$ = $1; }
| system_t_stmt_call { $$ = $1; }
// // Any system function as a task
| system_f_or_t_expr_call { $$ = new AstStmtExpr{$<fl>1, $1}; }
// // Not here in IEEE; from class_constructor_declaration
// // Because we've joined class_constructor_declaration into generic functions
// // Way over-permissive;
@ -4094,7 +4102,8 @@ function_subroutine_callNoMethod<nodeExprp>: // IEEE: function_subroutine
| funcRef yWITH__PAREN '(' expr ')' { $$ = new AstWithParse{$2, $1, $4}; }
// // can call as method and yWITH without parenthesis
| id yWITH__PAREN '(' expr ')' { $$ = new AstWithParse{$2, new AstFuncRef{$<fl>1, *$1, nullptr}, $4}; }
| system_f_call { $$ = $1; }
| system_f_only_expr_call { $$ = $1; }
| system_f_or_t_expr_call { $$ = $1; }
// // IEEE: method_call requires a "." so is in expr
// // IEEE: ['std::'] not needed, as normal std package resolution will find it
// // IEEE: randomize_call
@ -4104,7 +4113,7 @@ function_subroutine_callNoMethod<nodeExprp>: // IEEE: function_subroutine
| funcRef yWITH__PAREN_CUR '(' expr ')' constraint_block { $$ = new AstWithParse{$2, $1, $4, $6}; }
;
system_t_call<nodeStmtp>: // IEEE: system_tf_call (as task)
system_t_stmt_call<nodeStmtp>: // IEEE: part of system_tf_call (as task returning statement)
//
yaD_PLI systemDpiArgsE { AstTaskRef* const refp = new AstTaskRef{$<fl>1, *$1, $2};
refp->pli(true);
@ -4291,12 +4300,9 @@ system_t_call<nodeStmtp>: // IEEE: system_tf_call (as task)
fl_nowarn->warnOff(V3ErrorCode::WIDTH, true);
$$ = new AstAssertIntrinsic{fl_nowarn, new AstCastDynamic{fl_nowarn, $5, $3},
nullptr, nullptr}; }
//
// Any system function as a task
| system_f_call_or_t { $$ = new AstStmtExpr{$<fl>1, $1}; }
;
system_f_call<nodeExprp>: // IEEE: system_tf_call (as func)
system_f_only_expr_call<nodeExprp>: // IEEE: part of system_tf_call (for functions returning expressions)
yaD_PLI systemDpiArgsE { $$ = new AstFuncRef{$<fl>1, *$1, $2}; VN_CAST($$, FuncRef)->pli(true); }
//
| yD_C '(' cStrList ')' {
@ -4318,16 +4324,9 @@ system_f_call<nodeExprp>: // IEEE: system_tf_call (as func)
| yD_CAST '(' expr ',' expr ')' { $$ = new AstCastDynamic{$1, $5, $3}; }
| yD_STACKTRACE parenE { $$ = new AstStackTraceF{$1}; }
| yD_SYSTEM '(' expr ')' { $$ = new AstSystemF{$1, $3}; }
//
| system_f_call_or_t { $$ = $1; }
;
systemDpiArgsE<argp>: // IEEE: part of system_if_call for arguments of $dpi call
parenE { $$ = nullptr; }
| '(' exprList ')' { $$ = GRAMMARP->argWrapList($2); }
;
system_f_call_or_t<nodeExprp>: // IEEE: part of system_tf_call (can be task or func)
system_f_or_t_expr_call<nodeExprp>: // IEEE: part of system_tf_call (can be task or func)
yD_ACOS '(' expr ')' { $$ = new AstAcosD{$1, $3}; }
| yD_ACOSH '(' expr ')' { $$ = new AstAcoshD{$1, $3}; }
| yD_ASIN '(' expr ')' { $$ = new AstAsinD{$1, $3}; }
@ -4483,6 +4482,11 @@ severity_system_task_guts<nodep>: // IEEE: part of severity_system_task (1800
| yD_FATAL '(' expr ',' exprListE ')' { $$ = new AstElabDisplay{$1, VDisplayType::DT_FATAL, $5}; DEL($3); }
;
systemDpiArgsE<argp>: // IEEE: part of system_if_call for arguments of $dpi call
parenE { $$ = nullptr; }
| '(' exprList ')' { $$ = GRAMMARP->argWrapList($2); }
;
property_actual_arg<nodeExprp>: // ==IEEE: property_actual_arg
// // IEEE: property_expr
// // IEEE: sequence_actual_arg