@@ -4007,7 +4007,7 @@ unsigned_number: TOK_NUMBER
40074007// A.8.2 Subroutine calls
40084008
40094009tf_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
40214021list_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
40604070event_trigger: TOK_MINUSGREATER hierarchical_event_identifier ' ;'
40614071 { init ($$, ID_verilog_event_trigger); mto ($$, $2 ); }
0 commit comments