Update json.cpp
Ayyyy we actually make it to the end of a glTF2 now.
This commit is contained in:
21
src/json.cpp
21
src/json.cpp
@@ -109,15 +109,6 @@ namespace jjx::json {
|
||||
index++;
|
||||
}
|
||||
|
||||
/* If there's a decimal before a digit. Like ".006",
|
||||
* it's presumed a zero should be before the decimal. */
|
||||
if (raw_json[index] == '.') {
|
||||
token.value += '0';
|
||||
token.value += raw_json[index];
|
||||
decimal_present = true;
|
||||
index++;
|
||||
}
|
||||
|
||||
while(true) {
|
||||
if (index == raw_json.length())
|
||||
break;
|
||||
@@ -129,6 +120,18 @@ namespace jjx::json {
|
||||
decimal_present = true;
|
||||
token.value += c;
|
||||
}
|
||||
|
||||
// Scientific notation.
|
||||
else if (c == 'E' || c == 'e') {
|
||||
token.value += c;
|
||||
index++;
|
||||
if (raw_json[index] == '-') {
|
||||
token.value += raw_json[index];
|
||||
index++;
|
||||
}
|
||||
continue; // Loop early.
|
||||
}
|
||||
|
||||
// Only regex non-numeric values if we didn't catch it earlier.
|
||||
else if (!(c >= '0' && c <= '9'))
|
||||
break;
|
||||
|
Reference in New Issue
Block a user