1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Fix is_valid_float, Variant parser, Expression parser, script highlighter, and TextServer not handing capital E in scientific notation.

This commit is contained in:
Pāvels Nadtočajevs
2025-02-03 19:35:10 +02:00
parent a63a8b430b
commit b50d9742c2
10 changed files with 52 additions and 35 deletions

View File

@@ -4964,17 +4964,18 @@ bool String::is_valid_float() const {
bool numbers_found = false;
for (int i = from; i < len; i++) {
if (is_digit(operator[](i))) {
const char32_t c = operator[](i);
if (is_digit(c)) {
if (exponent_found) {
exponent_values_found = true;
} else {
numbers_found = true;
}
} else if (numbers_found && !exponent_found && operator[](i) == 'e') {
} else if (numbers_found && !exponent_found && (c == 'e' || c == 'E')) {
exponent_found = true;
} else if (!period_found && !exponent_found && operator[](i) == '.') {
} else if (!period_found && !exponent_found && c == '.') {
period_found = true;
} else if ((operator[](i) == '-' || operator[](i) == '+') && exponent_found && !exponent_values_found && !sign_found) {
} else if ((c == '-' || c == '+') && exponent_found && !exponent_values_found && !sign_found) {
sign_found = true;
} else {
return false; // no start with number plz