A dot is only considered part of a number when not followed by a letter
Closes #1306
}
}
let is_float = false;
- if rdr.curr() == '.' {
+ if rdr.curr() == '.' && !(is_alpha(rdr.next()) || rdr.next() == '_') {
is_float = true;
rdr.bump();
let dec_part = scan_digits(rdr, 10u);
}
if c == '.' {//Examine decimal part
- let decimal = 1.f;
+ let decimal = 1f;
while(pos < len) {
let char_range = str::char_range_at(num, pos);
c = char_range.ch;
pos = char_range.next;
alt c {
'0' | '1' | '2' | '3' | '4' | '5' | '6'| '7' | '8' | '9' {
- decimal /= 10.f;
+ decimal /= 10f;
total += (((c as int) - ('0' as int)) as float)*decimal;
}
'e' | 'E' {
let pos = 0u;
let len = str::byte_len(s);
let res = 0f;
- let neg = 1.f;
+ let neg = 1f;
alt str::char_at(s, 0u) {
'-' {
- neg = -1.f;
+ neg = -1f;
pos = 1u;
}
'+' {
ret (some(num(neg * res)), str::char_slice(s, pos, str::char_len(s)));
}
- let dec = 1.f;
+ let dec = 1f;
while (pos < len) {
let opos = pos;
let chr = str::char_range_at(s, pos);
pos = chr.next;
alt c {
'0' to '9' {
- dec /= 10.f;
+ dec /= 10f;
res += (((c as int) - ('0' as int)) as float) * dec;
}
_ { ret (some(num(neg * res)),
let d = 1E6;
let e = 3.0f32;
let f = 5.9f64;
- let g = 1.e6f32;
+ let g = 1e6f32;
let h = 1.0e7f64;
let i = 1.0E7f64;
let j = 3.1e+9;