From e58afa8ab5377a74bbd37ff02a719fc390f67900 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Thu, 24 Nov 2011 12:39:52 -0800 Subject: [PATCH] oops, radix prefixes shouldn't chain --- core/math/parser/parser-tests.factor | 3 +++ core/math/parser/parser.factor | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/math/parser/parser-tests.factor b/core/math/parser/parser-tests.factor index 5c44ed2ae5..265f095b9a 100644 --- a/core/math/parser/parser-tests.factor +++ b/core/math/parser/parser-tests.factor @@ -262,6 +262,9 @@ unit-test [ f ] [ "0o18" string>number ] unit-test [ f ] [ "0b12" string>number ] unit-test +[ 11 ] [ "0x0b" string>number ] unit-test +[ f ] [ "0x0o0" string>number ] unit-test + [ 0x7FFF,ABCD ] [ "0x7FFF,ABCD" string>number ] unit-test [ 1.0 ] [ "0x1.0p0" string>number ] unit-test diff --git a/core/math/parser/parser.factor b/core/math/parser/parser.factor index 8d006141e3..c0c3638776 100644 --- a/core/math/parser/parser.factor +++ b/core/math/parser/parser.factor @@ -228,9 +228,9 @@ DEFER: @neg-digit : @pos-first-digit ( i number-parse n char -- n/f ) { { CHAR: . [ ->required-mantissa ] } - { CHAR: 0 [ [ @pos-first-digit ] [ @pos-digit-or-punc ] with-radix-char ] } + { CHAR: 0 [ [ @pos-digit ] [ @pos-digit-or-punc ] with-radix-char ] } [ @pos-digit ] - } case ; inline recursive + } case ; inline : @neg-digit-or-punc ( i number-parse n char -- n/f ) { @@ -248,9 +248,9 @@ DEFER: @neg-digit : @neg-first-digit ( i number-parse n char -- n/f ) { { CHAR: . [ ->required-mantissa ] } - { CHAR: 0 [ [ @neg-first-digit ] [ @neg-digit-or-punc ] with-radix-char ] } + { CHAR: 0 [ [ @neg-digit ] [ @neg-digit-or-punc ] with-radix-char ] } [ @neg-digit ] - } case ; inline recursive + } case ; inline : @first-char ( i number-parse n char -- n/f ) {