oops, radix prefixes shouldn't chain

db4
Joe Groff 2011-11-24 12:39:52 -08:00
parent fa979425f3
commit e58afa8ab5
2 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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 )
{