Commit ea69d6ecda

Andrew Kelley <superjoe30@gmail.com>
2016-01-07 12:00:05
tokenize: detect "..." after a number literal
1 parent a3c9708
Changed files (1)
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;