summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--ext/tk/lib/tk.rb6
-rw-r--r--file.c1
-rw-r--r--parse.y21
-rw-r--r--range.c1
5 files changed, 30 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index dddc8f2..afb0910 100644
--- a/ChangeLog
+++ b/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>
* configure.in: use waitpid on mingw32.
* 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>
* mkconfig.rb, ext/configsub.rb: VERSION -> RUBY_VERSION.
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 217c76f..f10e8e2 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -1188,15 +1188,15 @@ class TkVariable
end
def to_i
- Integer(number(value))
+ number(value).to_i
end
def to_f
- Float(number(value))
+ number(value).to_f
end
def to_s
- String(string(value))
+ string(value).to_s
end
def inspect
diff --git a/file.c b/file.c
index 14c6d92..1cff477 100644
--- a/file.c
+++ b/file.c
@@ -1246,6 +1246,7 @@ rb_file_s_unlink(klass, args)
{
int n;
+ rb_secure(2);
n = apply2files(unlink_internal, args, 0);
return INT2FIX(n);
}
diff --git a/parse.y b/parse.y
index 1f79918..9696def 100644
--- a/parse.y
+++ b/parse.y
@@ -52,6 +52,7 @@ static enum lex_state {
EXPR_END, /* newline significant, +/- is a operator. */
EXPR_ARG, /* 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_FNAME, /* ignore newline, no reserved words. */
EXPR_DOT, /* right after `.' or `::', no reserved words. */
@@ -1089,13 +1090,13 @@ command_args : {
}
open_args : call_args
- | tLPAREN_ARG ')'
+ | tLPAREN_ARG {lex_state = EXPR_ENDARG;} ')'
{
rb_warning("%s (...) interpreted as method call",
rb_id2name(last_id));
$$ = 0;
}
- | tLPAREN_ARG call_args2 ')'
+ | tLPAREN_ARG call_args2 {lex_state = EXPR_ENDARG;} ')'
{
rb_warning("%s (...) interpreted as method call",
rb_id2name(last_id));
@@ -1185,7 +1186,7 @@ primary : literal
}
fixpos($$, $2);
}
- | tLPAREN_ARG expr ')'
+ | tLPAREN_ARG expr {lex_state = EXPR_ENDARG;} ')'
{
rb_warning("%s (...) interpreted as command call", rb_id2name(last_id));
$$ = $2;
@@ -3008,7 +3009,9 @@ yylex()
case '<':
c = nextc();
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)) {
int c2 = nextc();
int indent = 0;
@@ -3067,7 +3070,7 @@ yylex()
return parse_qstring(c,0);
case '?':
- if (lex_state == EXPR_END) {
+ if (lex_state == EXPR_END || lex_state == EXPR_ENDARG) {
lex_state = EXPR_BEG;
return '?';
}
@@ -3390,7 +3393,7 @@ yylex()
return tCOLON2;
}
pushback(c);
- if (lex_state == EXPR_END || ISSPACE(c)) {
+ if (lex_state == EXPR_END || lex_state == EXPR_ENDARG || ISSPACE(c)) {
lex_state = EXPR_BEG;
return ':';
}
@@ -3484,10 +3487,10 @@ yylex()
case '{':
if (!IS_ARG()) {
- if (lex_state != EXPR_END)
- c = tLBRACE;
- if (space_seen && CMDARG_P())
+ if (space_seen && lex_state == EXPR_ENDARG)
c = tLBRACE_ARG;
+ if (lex_state != EXPR_END && lex_state != EXPR_ENDARG)
+ c = tLBRACE;
}
COND_PUSH(0);
CMDARG_PUSH(0);
diff --git a/range.c b/range.c
index f6760ec..128733d 100644
--- a/range.c
+++ b/range.c
@@ -424,6 +424,7 @@ Init_Range()
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, "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);