* parse.y (program, stmt, primary): reduced duplicated code.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-07-13 02:09:40 +00:00
parent f64a557efd
commit 6dcf9f16cc
2 changed files with 8 additions and 12 deletions

View File

@ -1,3 +1,7 @@
Fri Jul 13 11:09:38 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (program, stmt, primary): reduced duplicated code.
Fri Jul 13 10:33:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri Jul 13 10:33:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* array.c (rb_ary_flatten_bang): check argument if valid * array.c (rb_ary_flatten_bang): check argument if valid

16
parse.y
View File

@ -708,11 +708,10 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
%% %%
program : { program : {
/*%%%*/
lex_state = EXPR_BEG; lex_state = EXPR_BEG;
/*%%%*/
local_push(compile_for_eval); local_push(compile_for_eval);
/*% /*%
lex_state = EXPR_BEG;
%*/ %*/
} }
compstmt compstmt
@ -926,15 +925,12 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
} }
| keyword_BEGIN | keyword_BEGIN
{ {
/*%%%*/
if (in_def || in_single) { if (in_def || in_single) {
yyerror("BEGIN in method"); yyerror("BEGIN in method");
} }
/*%%%*/
/* local_push(0); */ /* local_push(0); */
/*% /*%
if (in_def || in_single) {
yyerror("BEGIN in method");
}
%*/ %*/
} }
'{' compstmt '}' '{' compstmt '}'
@ -2765,14 +2761,12 @@ primary : literal
} }
| keyword_class cpath superclass | keyword_class cpath superclass
{ {
/*%%%*/
if (in_def || in_single) if (in_def || in_single)
yyerror("class definition in method body"); yyerror("class definition in method body");
/*%%%*/
local_push(0); local_push(0);
$<num>$ = ruby_sourceline; $<num>$ = ruby_sourceline;
/*% /*%
if (in_def || in_single)
yyerror("class definition in method body");
%*/ %*/
} }
bodystmt bodystmt
@ -2823,14 +2817,12 @@ primary : literal
} }
| keyword_module cpath | keyword_module cpath
{ {
/*%%%*/
if (in_def || in_single) if (in_def || in_single)
yyerror("module definition in method body"); yyerror("module definition in method body");
/*%%%*/
local_push(0); local_push(0);
$<num>$ = ruby_sourceline; $<num>$ = ruby_sourceline;
/*% /*%
if (in_def || in_single)
yyerror("module definition in method body");
%*/ %*/
} }
bodystmt bodystmt