Permalink
Browse files

Fix String#hex spec

Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
  • Loading branch information...
kronos authored and dbussink committed Jan 6, 2010
1 parent 621ee6d commit 8b99fe4f32d30d28db86f96e362a9bb7a2996e56
Showing with 8 additions and 4 deletions.
  1. +0 −1 spec/tags/ruby/core/string/hex_tags.txt
  2. +8 −3 vm/builtin/string.cpp
@@ -1 +0,0 @@
-fails:String#hex does not accept a sequence of underscores as part of a number
View
@@ -638,9 +638,14 @@ namespace rubinius {
// If it's an underscore, remember that. An underscore is valid iff
// it followed by a valid character for this base.
if(chr == '_') {
- // Double underscore is forbidden in strict mode.
- if(underscore && strict == Qtrue) {
- return (Integer*)Qnil;
+ if(underscore) {
+ // Double underscore is forbidden in strict mode.
+ if(strict == Qtrue) {
+ return (Integer*)Qnil;
+ } else {
+ // Stop parse number after two underscores in a row
+ goto return_value;
+ }
}
underscore = true;
continue;

0 comments on commit 8b99fe4

Please sign in to comment.