mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
72d9a8598d
commit
77b8745d4a
3 changed files with 17 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Sat Jan 20 03:54:00 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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'.
|
||||||
|
|
||||||
Thu Jan 18 04:28:14 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Thu Jan 18 04:28:14 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* io.c (rb_io_s_read): new method to call IO#read from
|
* io.c (rb_io_s_read): new method to call IO#read from
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# parsedate.rb: Written by Tadayoshi Funaba 2000
|
# parsedate3.rb: Written by Tadayoshi Funaba 2000, 2001
|
||||||
# $Id: parsedate.rb,v 1.2 2000-04-01 12:16:56+09 tadf Exp $
|
# $Id: parsedate3.rb,v 1.3 2001-01-18 12:09:47+09 tadf Exp $
|
||||||
|
|
||||||
module ParseDate
|
module ParseDate
|
||||||
|
|
||||||
|
@ -46,7 +46,12 @@ module ParseDate
|
||||||
hour = $1.to_i
|
hour = $1.to_i
|
||||||
min = $2.to_i
|
min = $2.to_i
|
||||||
sec = $3.to_i if $3
|
sec = $3.to_i if $3
|
||||||
hour += 12 if $4 and $4.downcase == 'p'
|
if $4
|
||||||
|
hour %= 12
|
||||||
|
if $4.downcase == 'p'
|
||||||
|
hour += 12
|
||||||
|
end
|
||||||
|
end
|
||||||
zone = $5
|
zone = $5
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
8
parse.y
8
parse.y
|
@ -67,7 +67,7 @@ static unsigned long cond_stack = 0;
|
||||||
cond_nest--;\
|
cond_nest--;\
|
||||||
cond_stack >>= 1;\
|
cond_stack >>= 1;\
|
||||||
} while (0)
|
} 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 class_nest = 0;
|
||||||
static int in_single = 0;
|
static int in_single = 0;
|
||||||
|
@ -1489,7 +1489,7 @@ method_call : operation '(' opt_call_args close_paren
|
||||||
|
|
||||||
close_paren : ')'
|
close_paren : ')'
|
||||||
{
|
{
|
||||||
if (!IN_COND) lex_state = EXPR_PAREN;
|
if (!COND_P()) lex_state = EXPR_PAREN;
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt_rhs : block_call
|
stmt_rhs : block_call
|
||||||
|
@ -3617,9 +3617,7 @@ yylex()
|
||||||
if (state == EXPR_FNAME) {
|
if (state == EXPR_FNAME) {
|
||||||
yylval.id = rb_intern(kw->name);
|
yylval.id = rb_intern(kw->name);
|
||||||
}
|
}
|
||||||
if (kw->id[0] == kDO &&
|
if (kw->id[0] == kDO && !COND_P() && state == EXPR_PAREN) {
|
||||||
(state == EXPR_PAREN ||
|
|
||||||
(!IN_COND && state == EXPR_ARG))) {
|
|
||||||
return kDO2;
|
return kDO2;
|
||||||
}
|
}
|
||||||
return kw->id[state != EXPR_BEG];
|
return kw->id[state != EXPR_BEG];
|
||||||
|
|
Loading…
Add table
Reference in a new issue