1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Fixed parsing of floats with ' separators

This commit is contained in:
Brian Fiete 2022-07-10 16:35:49 -04:00
parent 90de4fd2ea
commit 727f1b8cbc

View file

@ -1398,12 +1398,19 @@ double BfParser::ParseLiteralDouble()
char buf[256];
int len = std::min(mTokenEnd - mTokenStart, 255);
memcpy(buf, &mSrc[mTokenStart], len);
char c = buf[len - 1];
int outLen = 0;
for (int i = 0; i < len; i++)
{
char c = mSrc[mTokenStart + i];
if (c != '\'')
buf[outLen++] = c;
}
char c = buf[outLen - 1];
if ((c == 'd') || (c == 'D') || (c == 'f') || (c == 'F'))
buf[len - 1] = '\0';
buf[outLen - 1] = '\0';
else
buf[len] = '\0';
buf[outLen] = '\0';
return strtod(buf, NULL);
}