summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--bignum.c3
-rw-r--r--ext/curses/view2.rb2
-rw-r--r--parse.y62
-rw-r--r--range.c2
-rw-r--r--string.c7
6 files changed, 77 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index e43d4da..0a84a47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,12 +13,26 @@ Mon Jun 17 10:51:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* dln.c (dln_load): need to preserve dln_strerror() result,
calling other dl family can clear it.
+Sat Jun 15 22:56:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): obsolete '?<whitespace>'; use '?\s', '?\n',
+ etc, instead.
+
Sat Jun 15 18:51:13 2002 Akinori MUSHA <knu@iDaemons.org>
* dir.c (glob_helper): Use lstat() instead of stat() so it catches
a dead symlink. Given a dead symlink named "a", Dir.glob("?")
did catch it but Dir.glob("a") somehow didn't.
+Sat Jun 15 01:59:05 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (yylex): no here document after a dot.
+
+ * parse.y (yylex): should have set lex_state after '`'.
+
+ * parse.y (yylex): should have set lex_state properly after
+ tOP_ASGN.
+
Fri Jun 14 21:01:48 2002 KONISHI Hiromasa <konishih@fd6.so-net.ne.jp>
* bcc32/mkexports.rb: insert sleep(1) for win9x.
@@ -36,6 +50,10 @@ Fri Jun 14 15:22:19 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* regex.c (re_compile_pattern): ditto.
+Fri Jun 14 00:49:54 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big2dbl): return canonical HUGE_VAL for infinity.
+
Thu Jun 13 09:43:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (svalue_to_avalue): v may be Qundef. This fix was
diff --git a/bignum.c b/bignum.c
index 71e3347..132b611 100644
--- a/bignum.c
+++ b/bignum.c
@@ -798,6 +798,7 @@ rb_big2dbl(x)
while (i--) {
d = ds[i] + BIGRAD*d;
}
+ if (isinf(d)) d = HUGE_VAL;
if (!RBIGNUM(x)->sign) d = -d;
return d;
}
@@ -855,6 +856,8 @@ static VALUE
rb_big_eq(x, y)
VALUE x, y;
{
+ double d;
+
switch (TYPE(y)) {
case T_FIXNUM:
y = rb_int2big(FIX2LONG(y));
diff --git a/ext/curses/view2.rb b/ext/curses/view2.rb
index f953cdf..18d9619 100644
--- a/ext/curses/view2.rb
+++ b/ext/curses/view2.rb
@@ -77,7 +77,7 @@ while true
result = scroll_down
when Curses::KEY_UP, Curses::KEY_CTRL_P
result = scroll_up
- when Curses::KEY_NPAGE, ? # white space
+ when Curses::KEY_NPAGE, ?\s # white space
for i in 0..($screen.maxy - 2)
if( ! scroll_down )
if( i == 0 )
diff --git a/parse.y b/parse.y
index 0aec9f1..3dbc48f 100644
--- a/parse.y
+++ b/parse.y
@@ -3092,8 +3092,8 @@ yylex()
case '*':
if ((c = nextc()) == '*') {
if ((c = nextc()) == '=') {
- lex_state = EXPR_BEG;
yylval.id = tPOW;
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
@@ -3184,8 +3184,9 @@ yylex()
c = nextc();
if (c == '<' &&
lex_state != EXPR_END &&
- lex_state != EXPR_ENDARG
- && lex_state != EXPR_CLASS &&
+ lex_state != EXPR_DOT &&
+ lex_state != EXPR_ENDARG &&
+ lex_state != EXPR_CLASS &&
(!IS_ARG() || space_seen)) {
int c2 = nextc();
int indent = 0;
@@ -3216,8 +3217,8 @@ yylex()
}
if (c == '<') {
if ((c = nextc()) == '=') {
- lex_state = EXPR_BEG;
yylval.id = tLSHFT;
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
@@ -3238,8 +3239,8 @@ yylex()
}
if (c == '>') {
if ((c = nextc()) == '=') {
- lex_state = EXPR_BEG;
yylval.id = tRSHFT;
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
@@ -3250,9 +3251,19 @@ yylex()
case '"':
return parse_string(c,c,0);
+
case '`':
- if (lex_state == EXPR_FNAME) return c;
- if (lex_state == EXPR_DOT) return c;
+ if (lex_state == EXPR_FNAME) {
+ lex_state = EXPR_END;
+ return c;
+ }
+ if (lex_state == EXPR_DOT) {
+ if (cmd_state)
+ lex_state = EXPR_CMDARG;
+ else
+ lex_state = EXPR_ARG;
+ return c;
+ }
return parse_string(c,c,0);
case '\'':
@@ -3268,12 +3279,32 @@ yylex()
rb_compile_error("incomplete character syntax");
return 0;
}
- if (IS_ARG() && ISSPACE(c)){
+ if (ISSPACE(c)){
+ if (!IS_ARG()){
+ int c = 0;
+ switch (c) {
+ case ' ':
+ c = 's';
+ break;
+ case '\n':
+ c = 'n';
+ break;
+ case '\t':
+ c = 't';
+ break;
+ case '\v':
+ c = 'v';
+ break;
+ }
+ if (c) {
+ rb_warn("invalid character syntax; use ?\\%c", c);
+ }
+ }
pushback(c);
lex_state = EXPR_BEG;
return '?';
}
- if (c == '\\') {
+ else if (c == '\\') {
c = read_escape();
}
c &= 0xff;
@@ -3286,6 +3317,7 @@ yylex()
lex_state = EXPR_BEG;
if ((c = nextc()) == '=') {
yylval.id = tANDOP;
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
@@ -3320,14 +3352,15 @@ yylex()
lex_state = EXPR_BEG;
if ((c = nextc()) == '=') {
yylval.id = tOROP;
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
return tOROP;
}
if (c == '=') {
- lex_state = EXPR_BEG;
yylval.id = '|';
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
if (lex_state == EXPR_FNAME || lex_state == EXPR_DOT) {
@@ -3350,8 +3383,8 @@ yylex()
return '+';
}
if (c == '=') {
- lex_state = EXPR_BEG;
yylval.id = '+';
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
if (lex_state == EXPR_BEG || lex_state == EXPR_MID ||
@@ -3380,8 +3413,8 @@ yylex()
return '-';
}
if (c == '=') {
- lex_state = EXPR_BEG;
yylval.id = '-';
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
if (lex_state == EXPR_BEG || lex_state == EXPR_MID ||
@@ -3630,8 +3663,8 @@ yylex()
return parse_regx('/', '/');
}
if ((c = nextc()) == '=') {
- lex_state = EXPR_BEG;
yylval.id = '/';
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
pushback(c);
@@ -3651,8 +3684,8 @@ yylex()
case '^':
if ((c = nextc()) == '=') {
- lex_state = EXPR_BEG;
yylval.id = '^';
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
switch (lex_state) {
@@ -3800,6 +3833,7 @@ yylex()
}
if ((c = nextc()) == '=') {
yylval.id = '%';
+ lex_state = EXPR_BEG;
return tOP_ASGN;
}
if (IS_ARG() && space_seen && !ISSPACE(c)) {
diff --git a/range.c b/range.c
index 436486f..4db96f4 100644
--- a/range.c
+++ b/range.c
@@ -495,7 +495,7 @@ Init_Range()
rb_include_module(rb_cRange, rb_mEnumerable);
rb_define_method(rb_cRange, "initialize", range_initialize, -1);
rb_define_method(rb_cRange, "==", range_eq, 1);
- rb_define_method(rb_cRange, "===", range_member, 1);
+ rb_define_method(rb_cRange, "===", range_include, 1);
rb_define_method(rb_cRange, "eql?", range_eql, 1);
rb_define_method(rb_cRange, "hash", range_hash, 0);
rb_define_method(rb_cRange, "each", range_each, 0);
diff --git a/string.c b/string.c
index 8abce20..9894423 100644
--- a/string.c
+++ b/string.c
@@ -2991,11 +2991,16 @@ rb_str_crypt(str, salt)
VALUE str, salt;
{
extern char *crypt();
+ VALUE result;
StringValue(salt);
if (RSTRING(salt)->len < 2)
rb_raise(rb_eArgError, "salt too short(need >=2 bytes)");
- return rb_tainted_str_new2(crypt(RSTRING(str)->ptr, RSTRING(salt)->ptr));
+
+ result = rb_str_new2(crypt(RSTRING(str)->ptr, RSTRING(salt)->ptr));
+ OBJ_INFECT(result, str);
+ OBJ_INFECT(result, salt);
+ return result;
}
static VALUE