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
ab427b8c
Kaydet (Commit)
ab427b8c
authored
Agu 18, 2001
tarafından
Jeremy Hylton
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Generate correct reprs for Mul, Add, etc.
üst
ec5bfd13
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
40 deletions
+20
-40
ast.py
Lib/compiler/ast.py
+8
-20
astgen.py
Tools/compiler/astgen.py
+2
-0
ast.py
Tools/compiler/compiler/ast.py
+8
-20
astgen.py
Tools/compiler/compiler/astgen.py
+2
-0
No files found.
Lib/compiler/ast.py
Dosyayı görüntüle @
ab427b8c
...
...
@@ -2,9 +2,6 @@
This file is automatically generated.
"""
# XXX performance issues:
# 1. getChildren() could be more efficient for many cases
from
types
import
TupleType
,
ListType
from
consts
import
CO_VARARGS
,
CO_VARKEYWORDS
...
...
@@ -193,7 +190,7 @@ class Sub(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"Sub(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"Sub(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
ListCompIf
(
Node
):
nodes
[
"listcompif"
]
=
"ListCompIf"
...
...
@@ -212,7 +209,7 @@ class Div(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"Div(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"Div(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Discard
(
Node
):
nodes
[
"discard"
]
=
"Discard"
...
...
@@ -240,7 +237,7 @@ class RightShift(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"RightShift(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"RightShift(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Continue
(
Node
):
nodes
[
"continue"
]
=
"Continue"
...
...
@@ -280,7 +277,7 @@ class LeftShift(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"LeftShift(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"LeftShift(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Mul
(
Node
):
nodes
[
"mul"
]
=
"Mul"
...
...
@@ -290,7 +287,7 @@ class Mul(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"Mul(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"Mul(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Yield
(
Node
):
nodes
[
"yield"
]
=
"Yield"
...
...
@@ -368,7 +365,7 @@ class Mod(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"Mod(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"Mod(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Class
(
Node
):
nodes
[
"class"
]
=
"Class"
...
...
@@ -466,7 +463,7 @@ class Power(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"Power(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"Power(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Ellipsis
(
Node
):
nodes
[
"ellipsis"
]
=
"Ellipsis"
...
...
@@ -486,15 +483,6 @@ class Return(Node):
def
__repr__
(
self
):
return
"Return(
%
s)"
%
(
repr
(
self
.
value
),)
class
Yield
(
Node
):
nodes
[
"yield"
]
=
"Yield"
def
__init__
(
self
,
value
):
self
.
value
=
value
def
_getChildren
(
self
):
return
self
.
value
,
def
__repr__
(
self
):
return
"Yield(
%
s)"
%
repr
(
self
.
value
)
class
Add
(
Node
):
nodes
[
"add"
]
=
"Add"
def
__init__
(
self
,
(
left
,
right
)):
...
...
@@ -503,7 +491,7 @@ class Add(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"Add(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"Add(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Function
(
Node
):
nodes
[
"function"
]
=
"Function"
...
...
Tools/compiler/astgen.py
Dosyayı görüntüle @
ab427b8c
...
...
@@ -81,6 +81,8 @@ class NodeInfo:
print
>>
buf
,
" def __repr__(self):"
if
self
.
argnames
:
fmt
=
COMMA
.
join
([
"
%
s"
]
*
self
.
nargs
)
if
'('
in
self
.
args
:
fmt
=
'(
%
s)'
%
fmt
vals
=
[
"repr(self.
%
s)"
%
name
for
name
in
self
.
argnames
]
vals
=
COMMA
.
join
(
vals
)
if
self
.
nargs
==
1
:
...
...
Tools/compiler/compiler/ast.py
Dosyayı görüntüle @
ab427b8c
...
...
@@ -2,9 +2,6 @@
This file is automatically generated.
"""
# XXX performance issues:
# 1. getChildren() could be more efficient for many cases
from
types
import
TupleType
,
ListType
from
consts
import
CO_VARARGS
,
CO_VARKEYWORDS
...
...
@@ -193,7 +190,7 @@ class Sub(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"Sub(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"Sub(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
ListCompIf
(
Node
):
nodes
[
"listcompif"
]
=
"ListCompIf"
...
...
@@ -212,7 +209,7 @@ class Div(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"Div(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"Div(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Discard
(
Node
):
nodes
[
"discard"
]
=
"Discard"
...
...
@@ -240,7 +237,7 @@ class RightShift(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"RightShift(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"RightShift(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Continue
(
Node
):
nodes
[
"continue"
]
=
"Continue"
...
...
@@ -280,7 +277,7 @@ class LeftShift(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"LeftShift(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"LeftShift(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Mul
(
Node
):
nodes
[
"mul"
]
=
"Mul"
...
...
@@ -290,7 +287,7 @@ class Mul(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"Mul(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"Mul(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Yield
(
Node
):
nodes
[
"yield"
]
=
"Yield"
...
...
@@ -368,7 +365,7 @@ class Mod(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"Mod(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"Mod(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Class
(
Node
):
nodes
[
"class"
]
=
"Class"
...
...
@@ -466,7 +463,7 @@ class Power(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"Power(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"Power(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Ellipsis
(
Node
):
nodes
[
"ellipsis"
]
=
"Ellipsis"
...
...
@@ -486,15 +483,6 @@ class Return(Node):
def
__repr__
(
self
):
return
"Return(
%
s)"
%
(
repr
(
self
.
value
),)
class
Yield
(
Node
):
nodes
[
"yield"
]
=
"Yield"
def
__init__
(
self
,
value
):
self
.
value
=
value
def
_getChildren
(
self
):
return
self
.
value
,
def
__repr__
(
self
):
return
"Yield(
%
s)"
%
repr
(
self
.
value
)
class
Add
(
Node
):
nodes
[
"add"
]
=
"Add"
def
__init__
(
self
,
(
left
,
right
)):
...
...
@@ -503,7 +491,7 @@ class Add(Node):
def
_getChildren
(
self
):
return
self
.
left
,
self
.
right
def
__repr__
(
self
):
return
"Add(
%
s,
%
s
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
return
"Add(
(
%
s,
%
s)
)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Function
(
Node
):
nodes
[
"function"
]
=
"Function"
...
...
Tools/compiler/compiler/astgen.py
Dosyayı görüntüle @
ab427b8c
...
...
@@ -81,6 +81,8 @@ class NodeInfo:
print
>>
buf
,
" def __repr__(self):"
if
self
.
argnames
:
fmt
=
COMMA
.
join
([
"
%
s"
]
*
self
.
nargs
)
if
'('
in
self
.
args
:
fmt
=
'(
%
s)'
%
fmt
vals
=
[
"repr(self.
%
s)"
%
name
for
name
in
self
.
argnames
]
vals
=
COMMA
.
join
(
vals
)
if
self
.
nargs
==
1
:
...
...
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