Skip to content

Commit c95629f

Browse files
authored
Merge pull request #947 from diffblue/task_invocation1-fix
Verilog: allow task invocations without parentheses
2 parents 7dfd0f2 + e5ec41b commit c95629f

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
KNOWNBUG
1+
CORE
22
task_invocation1.sv
33

44
^EXIT=0$
55
^SIGNAL=0$
66
--
77
^warning: ignoring
88
--
9-
The parser rejects invocations without ().

src/verilog/parser.y

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4007,7 +4007,7 @@ unsigned_number: TOK_NUMBER
40074007
// A.8.2 Subroutine calls
40084008

40094009
tf_call:
4010-
hierarchical_tf_identifier list_of_arguments_paren
4010+
hierarchical_identifier list_of_arguments_paren_opt
40114011
{ init($$, ID_function_call);
40124012
stack_expr($$).operands().reserve(2);
40134013
mto($$, $1); mto($$, $2); }
@@ -4020,6 +4020,7 @@ list_of_arguments_paren:
40204020

40214021
list_of_arguments_paren_opt:
40224022
/* Optional */
4023+
{ init($$); }
40234024
| list_of_arguments_paren
40244025
;
40254026

@@ -4054,8 +4055,17 @@ subroutine_call:
40544055
| system_tf_call
40554056
;
40564057

4057-
function_subroutine_call: subroutine_call
4058-
;
4058+
// We deviate from the 1800-2017 grammar to remove the ambiguity
4059+
// between function calls without parentheses and variables.
4060+
// Note that this does not affect system function identifiers ($...),
4061+
// which cannot be variables.
4062+
function_subroutine_call:
4063+
hierarchical_tf_identifier list_of_arguments_paren
4064+
{ init($$, ID_function_call);
4065+
stack_expr($$).operands().reserve(2);
4066+
mto($$, $1); mto($$, $2); }
4067+
| system_tf_call
4068+
;
40594069

40604070
event_trigger: TOK_MINUSGREATER hierarchical_event_identifier ';'
40614071
{ init($$, ID_verilog_event_trigger); mto($$, $2); }

0 commit comments

Comments
 (0)