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
ec927348
Kaydet (Commit)
ec927348
authored
Agu 18, 2001
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add Yield() statement handler
Fix Module() handler to avoid including the doc string in the AST
üst
9fa96bed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
transformer.py
Lib/compiler/transformer.py
+11
-1
transformer.py
Tools/compiler/compiler/transformer.py
+11
-1
No files found.
Lib/compiler/transformer.py
Dosyayı görüntüle @
ec927348
...
...
@@ -153,8 +153,12 @@ class Transformer:
def
file_input
(
self
,
nodelist
):
doc
=
self
.
get_docstring
(
nodelist
,
symbol
.
file_input
)
if
doc
is
not
None
:
i
=
1
else
:
i
=
0
stmts
=
[]
for
node
in
nodelist
:
for
node
in
nodelist
[
i
:]
:
if
node
[
0
]
!=
token
.
ENDMARKER
and
node
[
0
]
!=
token
.
NEWLINE
:
self
.
com_append_stmt
(
stmts
,
node
)
return
Module
(
doc
,
Stmt
(
stmts
))
...
...
@@ -340,6 +344,11 @@ class Transformer:
n
.
lineno
=
nodelist
[
0
][
2
]
return
n
def
yield_stmt
(
self
,
nodelist
):
n
=
Yield
(
self
.
com_node
(
nodelist
[
1
]))
n
.
lineno
=
nodelist
[
0
][
2
]
return
n
def
raise_stmt
(
self
,
nodelist
):
# raise: [test [',' test [',' test]]]
if
len
(
nodelist
)
>
5
:
...
...
@@ -1245,6 +1254,7 @@ _legal_node_types = [
symbol
.
continue_stmt
,
symbol
.
return_stmt
,
symbol
.
raise_stmt
,
symbol
.
yield_stmt
,
symbol
.
import_stmt
,
symbol
.
global_stmt
,
symbol
.
exec_stmt
,
...
...
Tools/compiler/compiler/transformer.py
Dosyayı görüntüle @
ec927348
...
...
@@ -153,8 +153,12 @@ class Transformer:
def
file_input
(
self
,
nodelist
):
doc
=
self
.
get_docstring
(
nodelist
,
symbol
.
file_input
)
if
doc
is
not
None
:
i
=
1
else
:
i
=
0
stmts
=
[]
for
node
in
nodelist
:
for
node
in
nodelist
[
i
:]
:
if
node
[
0
]
!=
token
.
ENDMARKER
and
node
[
0
]
!=
token
.
NEWLINE
:
self
.
com_append_stmt
(
stmts
,
node
)
return
Module
(
doc
,
Stmt
(
stmts
))
...
...
@@ -340,6 +344,11 @@ class Transformer:
n
.
lineno
=
nodelist
[
0
][
2
]
return
n
def
yield_stmt
(
self
,
nodelist
):
n
=
Yield
(
self
.
com_node
(
nodelist
[
1
]))
n
.
lineno
=
nodelist
[
0
][
2
]
return
n
def
raise_stmt
(
self
,
nodelist
):
# raise: [test [',' test [',' test]]]
if
len
(
nodelist
)
>
5
:
...
...
@@ -1245,6 +1254,7 @@ _legal_node_types = [
symbol
.
continue_stmt
,
symbol
.
return_stmt
,
symbol
.
raise_stmt
,
symbol
.
yield_stmt
,
symbol
.
import_stmt
,
symbol
.
global_stmt
,
symbol
.
exec_stmt
,
...
...
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