1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-29 03:19:54 +00:00

Fix parsing bug for numbers.

This commit is contained in:
Calvin Rose 2019-01-17 12:32:51 -05:00
parent 2c1b506213
commit 63137b8107

View File

@ -294,7 +294,7 @@ static int tokenchar(JanetParser *p, JanetParseState *state, uint8_t c) {
/* Token finished */ /* Token finished */
blen = (int32_t) p->bufcount; blen = (int32_t) p->bufcount;
int start_dig = p->buf[0] >= '0' && p->buf[0] <= '9'; int start_dig = p->buf[0] >= '0' && p->buf[0] <= '9';
int start_num = start_dig || p->buf[0] == '-' || p->buf[0] == '+'; int start_num = start_dig || p->buf[0] == '-' || p->buf[0] == '+' || p->buf[0] == '.';
if (p->buf[0] == ':') { if (p->buf[0] == ':') {
ret = janet_keywordv(p->buf + 1, blen - 1); ret = janet_keywordv(p->buf + 1, blen - 1);
} else if (start_num && !janet_scan_number(p->buf, blen, &numval)) { } else if (start_num && !janet_scan_number(p->buf, blen, &numval)) {