state_call needs parenthesis around func_expr_list

- Fixed: state_call needs to enclose func_expr_list in LPAREN/RPAREN
  itself, because func_expr_list doesn't include them. This means it also
  needs a separate production to accept calls without a parameter list.
This commit is contained in:
Randy Heit 2013-07-23 19:34:21 -05:00
parent 46c0127ebb
commit 0d25ed8289

View file

@ -256,6 +256,7 @@ enumerator(X) ::= IDENTIFIER(A) EQ expr(B). /* Expression must be constant. */
%type state_goto_offset {ZCC_Expression *} %type state_goto_offset {ZCC_Expression *}
%type state_action {ZCC_TreeNode *} %type state_action {ZCC_TreeNode *}
%type state_call {ZCC_ExprFuncCall *} %type state_call {ZCC_ExprFuncCall *}
%type state_call_params {ZCC_FuncParm *}
%include { %include {
struct StateOpts { struct StateOpts {
@ -348,7 +349,7 @@ state_action(X) ::= LBRACE error scanner_mode RBRACE. { X = NULL; }
state_action(X) ::= state_call(A) scanner_mode SEMICOLON. { X = A; } state_action(X) ::= state_call(A) scanner_mode SEMICOLON. { X = A; }
state_call(X) ::= . { X = NULL; } state_call(X) ::= . { X = NULL; }
state_call(X) ::= IDENTIFIER(A) func_expr_list(B). state_call(X) ::= IDENTIFIER(A) state_call_params(B).
{ {
NEW_AST_NODE(ExprFuncCall, expr); NEW_AST_NODE(ExprFuncCall, expr);
NEW_AST_NODE(ExprID, func); NEW_AST_NODE(ExprID, func);
@ -361,6 +362,9 @@ state_call(X) ::= IDENTIFIER(A) func_expr_list(B).
X = expr; X = expr;
} }
state_call_params(X) ::= . { X = NULL; }
state_call_params(X) ::= LPAREN func_expr_list(A) RPAREN. { X = A; }
/* Definition of a default class instance. */ /* Definition of a default class instance. */
%type default_def {ZCC_CompoundStmt *} %type default_def {ZCC_CompoundStmt *}
default_def(X) ::= DEFAULT compound_statement(A). { X = A; } default_def(X) ::= DEFAULT compound_statement(A). { X = A; }