Util: Fix Parser number error detection
This commit is contained in:
@@ -211,14 +211,16 @@ Value Parser::getNumber()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fractionPosition == exponentPosition - 1) {
|
if (fractionPosition != 0 || exponentPosition != 0) {
|
||||||
reportError(token, "invalid exponent sign, expected number");
|
if (fractionPosition == exponentPosition - 1) {
|
||||||
return nullptr;
|
reportError(token, "invalid exponent sign, expected number");
|
||||||
}
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (fractionPosition == length - 1 || exponentPosition == length - 1) {
|
if (fractionPosition == length - 1 || exponentPosition == length - 1) {
|
||||||
reportError(token, "invalid number");
|
reportError(token, "invalid number");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::stod(token.symbol);
|
return std::stod(token.symbol);
|
||||||
|
|||||||
Reference in New Issue
Block a user