Splitting a parser rule for function prototype.

This commit is contained in:
Stefano Sanfilippo 2015-03-08 12:52:38 +01:00
parent e933e75c85
commit 3aade87599

View File

@ -98,6 +98,7 @@
Id* idval; Id* idval;
Number* numericval; Number* numericval;
Function* funval; Function* funval;
FunctionPrototype* protoval;
FunArg *argval; FunArg *argval;
PointerList<FunArg> *arglistval; PointerList<FunArg> *arglistval;
} }
@ -114,6 +115,7 @@
%type<argval> arg_decl %type<argval> arg_decl
%type<arglistval> args_decl args %type<arglistval> args_decl args
%type<funval> fun_decl main %type<funval> fun_decl main
%type<protoval> fun_proto
%type<printval> print_stmt %type<printval> print_stmt
%type<inputval> input_stmt %type<inputval> input_stmt
%type<abortval> abort_stmt %type<abortval> abort_stmt
@ -149,8 +151,13 @@ fun_decls:
fun_decls fun_decls
; ;
fun_decl: fun_decl:
FUN_DECL fun_return ID args FUN_END statements { fun_proto statements {
$$ = new Function(new FunctionPrototype(new Id($3), $2, $4), $6); $$ = new Function($1, $2);
}
;
fun_proto:
FUN_DECL fun_return ID args FUN_END {
$$ = new FunctionPrototype(new Id($3), $2, $4);
} }
; ;
fun_return: fun_return: