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:
parent
90de4fd2ea
commit
727f1b8cbc
1 changed files with 11 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue