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