summaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-13 02:09:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-13 02:09:40 +0000
commit9835ee3c8e67c1ee121dbe3493e5da7c06f178b0 (patch)
tree73e9e67bb9ac088dd7044d9cf559625f9da07e89 /parse.y
parent85015fde941b2fa643975ce81e2d7de86a38506a (diff)
downloadruby-9835ee3c8e67c1ee121dbe3493e5da7c06f178b0.tar.gz
ruby-9835ee3c8e67c1ee121dbe3493e5da7c06f178b0.tar.xz
ruby-9835ee3c8e67c1ee121dbe3493e5da7c06f178b0.zip
* parse.y (program, stmt, primary): reduced duplicated code.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y16
1 files changed, 4 insertions, 12 deletions
diff --git a/parse.y b/parse.y
index bb39af8e3..23f2aef3d 100644
--- a/parse.y
+++ b/parse.y
@@ -708,11 +708,10 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
%%
program : {
- /*%%%*/
lex_state = EXPR_BEG;
+ /*%%%*/
local_push(compile_for_eval);
/*%
- lex_state = EXPR_BEG;
%*/
}
compstmt
@@ -926,15 +925,12 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
}
| keyword_BEGIN
{
- /*%%%*/
if (in_def || in_single) {
yyerror("BEGIN in method");
}
+ /*%%%*/
/* local_push(0); */
/*%
- if (in_def || in_single) {
- yyerror("BEGIN in method");
- }
%*/
}
'{' compstmt '}'
@@ -2765,14 +2761,12 @@ primary : literal
}
| keyword_class cpath superclass
{
- /*%%%*/
if (in_def || in_single)
yyerror("class definition in method body");
+ /*%%%*/
local_push(0);
$<num>$ = ruby_sourceline;
/*%
- if (in_def || in_single)
- yyerror("class definition in method body");
%*/
}
bodystmt
@@ -2823,14 +2817,12 @@ primary : literal
}
| keyword_module cpath
{
- /*%%%*/
if (in_def || in_single)
yyerror("module definition in method body");
+ /*%%%*/
local_push(0);
$<num>$ = ruby_sourceline;
/*%
- if (in_def || in_single)
- yyerror("module definition in method body");
%*/
}
bodystmt