diff options
| author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-30 03:07:37 +0000 |
|---|---|---|
| committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-30 03:07:37 +0000 |
| commit | 8cdcb980d2b312257aa9e696f53252c037671404 (patch) | |
| tree | 511b241c3f50858f86adbcf2c3ced9bfe2945168 | |
| parent | dcf292877fea163e0f93bcd00a484af1fc0f4295 (diff) | |
| download | ruby-8cdcb980d2b312257aa9e696f53252c037671404.tar.gz ruby-8cdcb980d2b312257aa9e696f53252c037671404.tar.xz ruby-8cdcb980d2b312257aa9e696f53252c037671404.zip | |
* bignum.c (rb_cstr_to_inum): '0_2' is a valid representatin.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | bignum.c | 14 |
2 files changed, 15 insertions, 3 deletions
@@ -1,3 +1,7 @@ +Wed Jan 30 12:06:43 2008 Tadayoshi Funaba <tadf@dotrb.org> + + * bignum.c (rb_cstr_to_inum): '0_2' is a valid representatin. + Wed Jan 30 11:57:50 2008 NARUSE, Yui <naruse@ruby-lang.org> * bootstraptest/runner.rb: fix -I../../hoge case. @@ -438,7 +438,7 @@ rb_cstr_to_inum(const char *str, int base, int badcheck) len = 2; break; case 8: - if (str[0] == '0' && (str[1] == 'o'||str[1] == 'O'||str[1] == '_')) { + if (str[0] == '0' && (str[1] == 'o'||str[1] == 'O')) { str += 2; } case 4: case 5: case 6: case 7: @@ -470,8 +470,16 @@ rb_cstr_to_inum(const char *str, int base, int badcheck) break; } if (*str == '0') { /* squeeze preceding 0s */ - while (*++str == '0'); - if (!(c = *str) || ISSPACE(c)) --str; + int nn = 0; + while ((c = *++str) == '0' || c == '_') { + if (c == '_') { + nn++; + if (nn >= 2) + break; + } else + nn = 0; + } + if (!(c = *str) || ISSPACE(c)) --str; } c = *str; c = conv_digit(c); |
