Mercurial > cpython-lru_cache-weakref
diff Python/ast.c @ 41235:6c8c33a43a15
"from ... import x" should not be a syntax error... make
import_stmt accept ELLIPSes and DOTs.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Mon, 19 Mar 2007 18:56:50 +0000 |
| parents | b1a18c7ed5ca |
| children | 060c79f6d919 |
line wrap: on
line diff
--- a/Python/ast.c Mon Mar 19 17:56:01 2007 +0000 +++ b/Python/ast.c Mon Mar 19 18:56:50 2007 +0000 @@ -2406,8 +2406,8 @@ /* import_stmt: import_name | import_from import_name: 'import' dotted_as_names - import_from: 'from' ('.'* dotted_name | '.') 'import' - ('*' | '(' import_as_names ')' | import_as_names) + import_from: 'from' (('.' | '...')* dotted_name | ('.' | '...')+) + 'import' ('*' | '(' import_as_names ')' | import_as_names) */ int lineno; int col_offset; @@ -2445,6 +2445,10 @@ mod = alias_for_import_name(c, CHILD(n, idx)); idx++; break; + } else if (TYPE(CHILD(n, idx)) == ELLIPSIS) { + /* three consecutive dots are tokenized as one ELLIPSIS */ + ndots += 3; + continue; } else if (TYPE(CHILD(n, idx)) != DOT) { break; }
