Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
e66c8c7c
Kaydet (Commit)
e66c8c7c
authored
Mar 19, 2007
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
"from ... import x" should not be a syntax error... make
import_stmt accept ELLIPSes and DOTs.
üst
d16e81aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
Grammar
Grammar/Grammar
+2
-1
ast.c
Python/ast.c
+6
-2
No files found.
Grammar/Grammar
Dosyayı görüntüle @
e66c8c7c
...
...
@@ -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]
...
...
Python/ast.c
Dosyayı görüntüle @
e66c8c7c
...
...
@@ -2406,8 +2406,8 @@ ast_for_import_stmt(struct compiling *c, const node *n)
/*
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 @@ ast_for_import_stmt(struct compiling *c, const node *n)
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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment