summaryrefslogtreecommitdiff
path: root/Grammar
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-03-19 18:56:50 +0000
committerGeorg Brandl <georg@python.org>2007-03-19 18:56:50 +0000
commit2ad8d02ea377944c66c12ce965d90896d52b4ca5 (patch)
treec4d0d96e91114832cc27c6390357ee6322204e5e /Grammar
parentf63534524c0d210f0c33c4138ecc9f31d4c5eda1 (diff)
downloadcpython-2ad8d02ea377944c66c12ce965d90896d52b4ca5.tar.gz
"from ... import x" should not be a syntax error... make
import_stmt accept ELLIPSes and DOTs.
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/Grammar3
1 files changed, 2 insertions, 1 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar
index e4cd3e07fe..41d8be8a9e 100644
--- a/Grammar/Grammar
+++ b/Grammar/Grammar
@@ -55,7 +55,8 @@ yield_stmt: yield_expr
raise_stmt: 'raise' [test [',' test [',' test]]]
import_stmt: import_name | import_from
import_name: 'import' dotted_as_names
-import_from: ('from' ('.'* dotted_name | '.'+)
+# note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
+import_from: ('from' (('.' | '...')* dotted_name | ('.' | '...')+)
'import' ('*' | '(' import_as_names ')' | import_as_names))
import_as_name: NAME ['as' NAME]
dotted_as_name: dotted_name ['as' NAME]