summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--parse.y15
-rw-r--r--regex.c2
-rw-r--r--sample/test.rb11
4 files changed, 9 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index f380764ed1..4d37e64694 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,11 @@ Mon Mar 11 21:03:37 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* ext/stringio: new.
+Mon Mar 11 18:03:37 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * regex.c (re_compile_pattern): '\0111' should be '\011' plus '1',
+ since octal literals are formed by three digits at most.
+
Mon Mar 11 14:44:38 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* marshal.c (w_object): module inclusion using extend() should
diff --git a/parse.y b/parse.y
index b94f1c0c61..c09fa4102e 100644
--- a/parse.y
+++ b/parse.y
@@ -2324,20 +2324,11 @@ read_escape()
case '0': case '1': case '2': case '3': /* octal constant */
case '4': case '5': case '6': case '7':
{
- char buf[3];
- int i;
+ int numlen;
pushback(c);
- for (i=0; i<3; i++) {
- c = nextc();
- if (c == -1) goto eof;
- if (c < '0' || '7' < c) {
- pushback(c);
- break;
- }
- buf[i] = c;
- }
- c = scan_oct(buf, i, &i);
+ c = scan_oct(lex_p, 3, &numlen);
+ lex_p += numlen;
}
return c;
diff --git a/regex.c b/regex.c
index 583dd20a65..3f38757656 100644
--- a/regex.c
+++ b/regex.c
@@ -2257,7 +2257,7 @@ re_compile_pattern(pattern, size, bufp)
/* octal */
case '0':
had_mbchar = 0;
- c = scan_oct(p, 3, &numlen);
+ c = scan_oct(p, 2, &numlen);
p += numlen;
had_num_literal = 1;
goto numeric_char;
diff --git a/sample/test.rb b/sample/test.rb
index 1f6b140951..82b159a7b7 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -1351,17 +1351,6 @@ atlas = Titans.new
test_ok(atlas.ruler0 == "Cronus")
test_ok(atlas.ruler3 == "Zeus")
-class <<a="a"
- def foo=(n)
- @@cv=n
- end
- def foo
- @@cv
- end
-end
-a.foo=5
-test_ok(a.foo == 5)
-
test_check "trace"
$x = 1234
$y = 0