From 77b8745d4a80e819fe523b4a4d0dbff3e779446a Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 19 Jan 2001 19:00:28 +0000 Subject: * parse.y (yylex): fixed serious syntax misbehavior. do's preceding was too high. a block in `foo bar do .. end' should be passed to `foo', not `bar'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index b6917d5975..4f519ba79c 100644 --- a/parse.y +++ b/parse.y @@ -67,7 +67,7 @@ static unsigned long cond_stack = 0; cond_nest--;\ cond_stack >>= 1;\ } while (0) -#define IN_COND (cond_nest > 0 && (cond_stack&1)) +#define COND_P() (cond_nest > 0 && (cond_stack&1)) static int class_nest = 0; static int in_single = 0; @@ -1489,7 +1489,7 @@ method_call : operation '(' opt_call_args close_paren close_paren : ')' { - if (!IN_COND) lex_state = EXPR_PAREN; + if (!COND_P()) lex_state = EXPR_PAREN; } stmt_rhs : block_call @@ -3617,9 +3617,7 @@ yylex() if (state == EXPR_FNAME) { yylval.id = rb_intern(kw->name); } - if (kw->id[0] == kDO && - (state == EXPR_PAREN || - (!IN_COND && state == EXPR_ARG))) { + if (kw->id[0] == kDO && !COND_P() && state == EXPR_PAREN) { return kDO2; } return kw->id[state != EXPR_BEG]; -- cgit v1.2.3