From 3aade87599861dc57874f062944c1ab867d95365 Mon Sep 17 00:00:00 2001 From: Stefano Sanfilippo Date: Sun, 8 Mar 2015 12:52:38 +0100 Subject: [PATCH] Splitting a parser rule for function prototype. --- Monicelli.ypp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Monicelli.ypp b/Monicelli.ypp index c2dfc8b..408078a 100644 --- a/Monicelli.ypp +++ b/Monicelli.ypp @@ -98,6 +98,7 @@ Id* idval; Number* numericval; Function* funval; + FunctionPrototype* protoval; FunArg *argval; PointerList *arglistval; } @@ -114,6 +115,7 @@ %type arg_decl %type args_decl args %type fun_decl main +%type fun_proto %type print_stmt %type input_stmt %type abort_stmt @@ -149,8 +151,13 @@ fun_decls: fun_decls ; fun_decl: - FUN_DECL fun_return ID args FUN_END statements { - $$ = new Function(new FunctionPrototype(new Id($3), $2, $4), $6); + fun_proto statements { + $$ = new Function($1, $2); + } +; +fun_proto: + FUN_DECL fun_return ID args FUN_END { + $$ = new FunctionPrototype(new Id($3), $2, $4); } ; fun_return: