commit ea69d6ecda8412cf47b85853c8645d453c826427 (tree) parent a3c97081ca37a6f78732c9a5f2244cef5a11cb07 Author: Andrew Kelley <superjoe30@gmail.com> Date: Thu, 7 Jan 2016 04:00:05 -0700 tokenize: detect "..." after a number literal Diffstat:
| M | src/tokenizer.cpp | | | 9 | +++++++++ |
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp @@ -816,6 +816,15 @@ void tokenize(Buf *buf, Tokenization *out) { case TokenizeStateNumber: { if (c == '.') { + if (t.pos + 1 < buf_len(t.buf)) { + uint8_t next_c = buf_ptr(t.buf)[t.pos + 1]; + if (next_c == '.') { + t.pos -= 1; + end_token(&t); + t.state = TokenizeStateStart; + continue; + } + } t.cur_tok->decimal_point_pos = t.pos; t.state = TokenizeStateFloatFraction; break;