Splitting a parser rule for function prototype.
This commit is contained in:
parent
e933e75c85
commit
3aade87599
|
@ -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:
|
||||||
|
|
Reference in New Issue
Block a user