correctly parse floats in scientific notation

GDScript incorrectly parsed float values in scientific notation
when no decimal point was given. "1e-5" was parsed as "15".

Fix this by not requiring a decimal point when we found an exponent
for the number to be considered a float.

Fixes #5267

(cherry picked from commit c246931f03)
This commit is contained in:
Dennis Brakhane 2016-06-18 13:18:31 +02:00 committed by Rémi Verschelde
parent 8df46cddcb
commit a04a78c7f6
1 changed files with 1 additions and 1 deletions

View File

@ -725,7 +725,7 @@ void GDTokenizerText::_advance() {
if (hexa_found) { if (hexa_found) {
int val = str.hex_to_int(); int val = str.hex_to_int();
_make_constant(val); _make_constant(val);
} else if (period_found) { } else if (period_found || exponent_found) {
real_t val = str.to_double(); real_t val = str.to_double();
//print_line("*%*%*%*% to convert: "+str+" result: "+rtos(val)); //print_line("*%*%*%*% to convert: "+str+" result: "+rtos(val));
_make_constant(val); _make_constant(val);