diff options
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/tokenizer.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 84bd60e..ec3c5db 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -93,6 +93,7 @@ char *_PyParser_TokenNames[] = { "DOUBLESLASHEQUAL", "AT", "RARROW", + "ELLIPSIS", /* This table must match the #defines in token.h! */ "OP", "<ERRORTOKEN>", @@ -1082,6 +1083,16 @@ PyToken_ThreeChars(int c1, int c2, int c3) break; } break; + case '.': + switch (c2) { + case '.': + switch (c3) { + case '.': + return ELLIPSIS; + } + break; + } + break; } return OP; } @@ -1278,13 +1289,22 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end) c = tok_nextc(tok); if (isdigit(c)) { goto fraction; - } - else { + } else if (c == '.') { + c = tok_nextc(tok); + if (c == '.') { + *p_start = tok->start; + *p_end = tok->cur; + return ELLIPSIS; + } else { + tok_backup(tok, c); + } + tok_backup(tok, '.'); + } else { tok_backup(tok, c); - *p_start = tok->start; - *p_end = tok->cur; - return DOT; } + *p_start = tok->start; + *p_end = tok->cur; + return DOT; } /* Number */ |