* parse.y (yylex): fixed 'print CGI::bar() {}, "\n"' syntax
breakage, adding new lex_state status. sigh. [new] * file.c (rb_file_s_unlink): should not allow if $SAFE >= 2. * range.c (Init_Range): define "to_ary". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
df2c6aef1e
commit
353650e6b4
13
ChangeLog
13
ChangeLog
@ -1,9 +1,22 @@
|
|||||||
|
Fri Jun 1 15:01:40 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y (yylex): fixed 'print CGI::bar() {}, "\n"' syntax
|
||||||
|
breakage, adding new lex_state status. sigh. [new]
|
||||||
|
|
||||||
Fri Jun 1 11:21:04 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
Fri Jun 1 11:21:04 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* configure.in: use waitpid on mingw32.
|
* configure.in: use waitpid on mingw32.
|
||||||
|
|
||||||
* ext/dbm/extconf.rb: include <ndbm.h>, not <gdbm.h>.
|
* ext/dbm/extconf.rb: include <ndbm.h>, not <gdbm.h>.
|
||||||
|
|
||||||
|
Thu May 31 18:34:57 2001 K.Kosako <kosako@sofnec.co.jp>
|
||||||
|
|
||||||
|
* file.c (rb_file_s_unlink): should not allow if $SAFE >= 2.
|
||||||
|
|
||||||
|
Thu May 31 17:23:25 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* range.c (Init_Range): define "to_ary".
|
||||||
|
|
||||||
Thu May 31 13:30:25 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
Thu May 31 13:30:25 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* mkconfig.rb, ext/configsub.rb: VERSION -> RUBY_VERSION.
|
* mkconfig.rb, ext/configsub.rb: VERSION -> RUBY_VERSION.
|
||||||
|
@ -1188,15 +1188,15 @@ class TkVariable
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_i
|
def to_i
|
||||||
Integer(number(value))
|
number(value).to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_f
|
def to_f
|
||||||
Float(number(value))
|
number(value).to_f
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
String(string(value))
|
string(value).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def inspect
|
def inspect
|
||||||
|
1
file.c
1
file.c
@ -1246,6 +1246,7 @@ rb_file_s_unlink(klass, args)
|
|||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
rb_secure(2);
|
||||||
n = apply2files(unlink_internal, args, 0);
|
n = apply2files(unlink_internal, args, 0);
|
||||||
return INT2FIX(n);
|
return INT2FIX(n);
|
||||||
}
|
}
|
||||||
|
21
parse.y
21
parse.y
@ -52,6 +52,7 @@ static enum lex_state {
|
|||||||
EXPR_END, /* newline significant, +/- is a operator. */
|
EXPR_END, /* newline significant, +/- is a operator. */
|
||||||
EXPR_ARG, /* newline significant, +/- is a operator. */
|
EXPR_ARG, /* newline significant, +/- is a operator. */
|
||||||
EXPR_CMDARG, /* newline significant, +/- is a operator. */
|
EXPR_CMDARG, /* newline significant, +/- is a operator. */
|
||||||
|
EXPR_ENDARG, /* newline significant, +/- is a operator. */
|
||||||
EXPR_MID, /* newline significant, +/- is a operator. */
|
EXPR_MID, /* newline significant, +/- is a operator. */
|
||||||
EXPR_FNAME, /* ignore newline, no reserved words. */
|
EXPR_FNAME, /* ignore newline, no reserved words. */
|
||||||
EXPR_DOT, /* right after `.' or `::', no reserved words. */
|
EXPR_DOT, /* right after `.' or `::', no reserved words. */
|
||||||
@ -1089,13 +1090,13 @@ command_args : {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open_args : call_args
|
open_args : call_args
|
||||||
| tLPAREN_ARG ')'
|
| tLPAREN_ARG {lex_state = EXPR_ENDARG;} ')'
|
||||||
{
|
{
|
||||||
rb_warning("%s (...) interpreted as method call",
|
rb_warning("%s (...) interpreted as method call",
|
||||||
rb_id2name(last_id));
|
rb_id2name(last_id));
|
||||||
$$ = 0;
|
$$ = 0;
|
||||||
}
|
}
|
||||||
| tLPAREN_ARG call_args2 ')'
|
| tLPAREN_ARG call_args2 {lex_state = EXPR_ENDARG;} ')'
|
||||||
{
|
{
|
||||||
rb_warning("%s (...) interpreted as method call",
|
rb_warning("%s (...) interpreted as method call",
|
||||||
rb_id2name(last_id));
|
rb_id2name(last_id));
|
||||||
@ -1185,7 +1186,7 @@ primary : literal
|
|||||||
}
|
}
|
||||||
fixpos($$, $2);
|
fixpos($$, $2);
|
||||||
}
|
}
|
||||||
| tLPAREN_ARG expr ')'
|
| tLPAREN_ARG expr {lex_state = EXPR_ENDARG;} ')'
|
||||||
{
|
{
|
||||||
rb_warning("%s (...) interpreted as command call", rb_id2name(last_id));
|
rb_warning("%s (...) interpreted as command call", rb_id2name(last_id));
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
@ -3008,7 +3009,9 @@ yylex()
|
|||||||
case '<':
|
case '<':
|
||||||
c = nextc();
|
c = nextc();
|
||||||
if (c == '<' &&
|
if (c == '<' &&
|
||||||
lex_state != EXPR_END && lex_state != EXPR_CLASS &&
|
lex_state != EXPR_END &&
|
||||||
|
lex_state != EXPR_ENDARG
|
||||||
|
&& lex_state != EXPR_CLASS &&
|
||||||
(!IS_ARG() || space_seen)) {
|
(!IS_ARG() || space_seen)) {
|
||||||
int c2 = nextc();
|
int c2 = nextc();
|
||||||
int indent = 0;
|
int indent = 0;
|
||||||
@ -3067,7 +3070,7 @@ yylex()
|
|||||||
return parse_qstring(c,0);
|
return parse_qstring(c,0);
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
if (lex_state == EXPR_END) {
|
if (lex_state == EXPR_END || lex_state == EXPR_ENDARG) {
|
||||||
lex_state = EXPR_BEG;
|
lex_state = EXPR_BEG;
|
||||||
return '?';
|
return '?';
|
||||||
}
|
}
|
||||||
@ -3390,7 +3393,7 @@ yylex()
|
|||||||
return tCOLON2;
|
return tCOLON2;
|
||||||
}
|
}
|
||||||
pushback(c);
|
pushback(c);
|
||||||
if (lex_state == EXPR_END || ISSPACE(c)) {
|
if (lex_state == EXPR_END || lex_state == EXPR_ENDARG || ISSPACE(c)) {
|
||||||
lex_state = EXPR_BEG;
|
lex_state = EXPR_BEG;
|
||||||
return ':';
|
return ':';
|
||||||
}
|
}
|
||||||
@ -3484,10 +3487,10 @@ yylex()
|
|||||||
|
|
||||||
case '{':
|
case '{':
|
||||||
if (!IS_ARG()) {
|
if (!IS_ARG()) {
|
||||||
if (lex_state != EXPR_END)
|
if (space_seen && lex_state == EXPR_ENDARG)
|
||||||
c = tLBRACE;
|
|
||||||
if (space_seen && CMDARG_P())
|
|
||||||
c = tLBRACE_ARG;
|
c = tLBRACE_ARG;
|
||||||
|
if (lex_state != EXPR_END && lex_state != EXPR_ENDARG)
|
||||||
|
c = tLBRACE;
|
||||||
}
|
}
|
||||||
COND_PUSH(0);
|
COND_PUSH(0);
|
||||||
CMDARG_PUSH(0);
|
CMDARG_PUSH(0);
|
||||||
|
1
range.c
1
range.c
@ -424,6 +424,7 @@ Init_Range()
|
|||||||
rb_define_method(rb_cRange, "end", range_last, 0);
|
rb_define_method(rb_cRange, "end", range_last, 0);
|
||||||
rb_define_method(rb_cRange, "to_s", range_to_s, 0);
|
rb_define_method(rb_cRange, "to_s", range_to_s, 0);
|
||||||
rb_define_method(rb_cRange, "inspect", range_inspect, 0);
|
rb_define_method(rb_cRange, "inspect", range_inspect, 0);
|
||||||
|
rb_define_alias(rb_cRange, "to_ary", "to_a");
|
||||||
|
|
||||||
rb_define_method(rb_cRange, "exclude_end?", range_exclude_end_p, 0);
|
rb_define_method(rb_cRange, "exclude_end?", range_exclude_end_p, 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user