From 0d25ed82896348f48ae60d89ace6dbea87244136 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 23 Jul 2013 19:34:21 -0500 Subject: [PATCH] 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. --- src/zscript/zcc-parse.lemon | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/zscript/zcc-parse.lemon b/src/zscript/zcc-parse.lemon index ed25532ca..92eb4d25e 100644 --- a/src/zscript/zcc-parse.lemon +++ b/src/zscript/zcc-parse.lemon @@ -256,6 +256,7 @@ enumerator(X) ::= IDENTIFIER(A) EQ expr(B). /* Expression must be constant. */ %type state_goto_offset {ZCC_Expression *} %type state_action {ZCC_TreeNode *} %type state_call {ZCC_ExprFuncCall *} +%type state_call_params {ZCC_FuncParm *} %include { 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_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(ExprID, func); @@ -361,6 +362,9 @@ state_call(X) ::= IDENTIFIER(A) func_expr_list(B). 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. */ %type default_def {ZCC_CompoundStmt *} default_def(X) ::= DEFAULT compound_statement(A). { X = A; }