=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/bc/bc.y,v retrieving revision 1.15 retrieving revision 1.16 diff -c -r1.15 -r1.16 *** src/usr.bin/bc/bc.y 2003/11/11 09:15:36 1.15 --- src/usr.bin/bc/bc.y 2003/11/11 19:49:02 1.16 *************** *** 1,5 **** %{ ! /* $OpenBSD: bc.y,v 1.15 2003/11/11 09:15:36 otto Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek --- 1,5 ---- %{ ! /* $OpenBSD: bc.y,v 1.16 2003/11/11 19:49:02 otto Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek *************** *** 31,37 **** */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: bc.y,v 1.15 2003/11/11 09:15:36 otto Exp $"; #endif /* not lint */ #include --- 31,37 ---- */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: bc.y,v 1.16 2003/11/11 19:49:02 otto Exp $"; #endif /* not lint */ #include *************** *** 266,288 **** fflush(stdout); exit(0); } ! | RETURN { if (nesting == 0) { warning("return must be in a function"); YYERROR; } ! $$ = node(cs("0"), epilogue, ! numnode(nesting), cs("Q"), END_NODE); } - | RETURN LPAR return_expression RPAR - { - if (nesting == 0) { - warning("return must be in a function"); - YYERROR; - } - $$ = $3; - } | FOR LPAR alloc_macro opt_expression SEMICOLON opt_relational_expression SEMICOLON opt_expression RPAR opt_statement pop_nesting --- 266,279 ---- fflush(stdout); exit(0); } ! | RETURN return_expression { if (nesting == 0) { warning("return must be in a function"); YYERROR; } ! $$ = $2; } | FOR LPAR alloc_macro opt_expression SEMICOLON opt_relational_expression SEMICOLON opt_expression RPAR opt_statement pop_nesting *************** *** 362,372 **** } ; ! function : function_header opt_parameter_list RPAR LBRACE NEWLINE opt_auto_define_list statement_list RBRACE { ! int n = node(prologue, $7, epilogue, cs("0"), numnode(nesting), cs("Q"), END_NODE); emit_macro($1, n); --- 353,363 ---- } ; ! function : function_header opt_parameter_list RPAR opt_newline LBRACE NEWLINE opt_auto_define_list statement_list RBRACE { ! int n = node(prologue, $8, epilogue, cs("0"), numnode(nesting), cs("Q"), END_NODE); emit_macro($1, n); *************** *** 387,392 **** --- 378,387 ---- } ; + opt_newline : /* empty */ + | NEWLINE + ; + opt_parameter_list : /* empty */ | parameter_list *************** *** 509,514 **** --- 504,514 ---- | expression { $$ = node($1, epilogue, + numnode(nesting), cs("Q"), END_NODE); + } + | LPAR RPAR + { + $$ = node(cs("0"), epilogue, numnode(nesting), cs("Q"), END_NODE); } ;