diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-01-19 19:00:28 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-01-19 19:00:28 +0000 |
| commit | a569c8bb5d743e026a5b61cea447c0ff92bbe918 (patch) | |
| tree | cb8733b904060e8d0b8cca7296baa113e36e7377 /parse.y | |
| parent | 4dc1042486ebc0f1f37179f7453f1ee9349db163 (diff) | |
| download | ruby-a569c8bb5d743e026a5b61cea447c0ff92bbe918.tar.gz ruby-a569c8bb5d743e026a5b61cea447c0ff92bbe918.tar.xz ruby-a569c8bb5d743e026a5b61cea447c0ff92bbe918.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@1141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
| -rw-r--r-- | parse.y | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -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]; |
