Accept . in numbers

This commit is contained in:
2025-05-13 13:55:26 -04:00
parent 4e4f69cb88
commit d0447e64b2

View File

@@ -366,7 +366,7 @@ private:
if (len == 0) { if (len == 0) {
return false; return false;
} }
if ('0' <= *buf && *buf <= '9') { if ('0' <= *buf && *buf <= '9' || (*buf == '.')) {
++buf; ++buf;
--len; --len;
} else { } else {
@@ -457,14 +457,14 @@ private:
} }
bool parse_number() { bool parse_number() {
char *const bufBefore = buf; char *const bufBefore = buf;
if (len == 0 || !('0' <= *buf && *buf <= '9')) { if (len == 0 || !('0' <= *buf && *buf <= '9' || (*buf == '.'))) {
return false; return false;
} }
callbacks->on_begin_number(data); callbacks->on_begin_number(data);
++buf; ++buf;
--len; --len;
for (;;) { for (;;) {
if ('0' <= *buf && *buf <= '9') { if ('0' <= *buf && *buf <= '9' || (*buf == '.')) {
++buf; ++buf;
--len; --len;
} else { } else {