From 46c0127ebb141de3ef9b3f00dc070829f2e7b9a3 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 23 Jul 2013 19:28:58 -0500 Subject: [PATCH] Don't accept function params starting with a comma - Fixed: func_expr_list would accept nonsense like this: Myfunction(, 1, 2); --- src/zscript/zcc-parse.lemon | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/zscript/zcc-parse.lemon b/src/zscript/zcc-parse.lemon index 41c605300..ed25532ca 100644 --- a/src/zscript/zcc-parse.lemon +++ b/src/zscript/zcc-parse.lemon @@ -991,17 +991,22 @@ expr_list(X) ::= expr_list(A) COMMA expr(B). * but once you do that, all remaining parameters must also be named. * We let higher-level code handle this to keep this file simpler. */ %type func_expr_list{ZCC_FuncParm *} +%type func_expr_list1{ZCC_FuncParm *} %type named_expr{ZCC_FuncParm *} func_expr_list(X) ::= . { X = NULL; } -func_expr_list(X) ::= named_expr(A). +func_expr_list(X) ::= func_expr_list1(A). { X = A; } -func_expr_list(X) ::= func_expr_list(A) COMMA named_expr(B). +func_expr_list1(X) ::= named_expr(A). +{ + X = A; +} +func_expr_list1(X) ::= func_expr_list1(A) COMMA named_expr(B). { X = A; A->AppendSibling(B);