Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7713ac2f
Commit
7713ac2f
authored
Aug 14, 2001
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Regenerated from new ast.txt and new astgen.py
parent
eef65908
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
24 deletions
+46
-24
Lib/compiler/ast.py
Lib/compiler/ast.py
+23
-12
Tools/compiler/compiler/ast.py
Tools/compiler/compiler/ast.py
+23
-12
No files found.
Lib/compiler/ast.py
View file @
7713ac2f
...
...
@@ -40,6 +40,8 @@ class Node:
return
flatten
(
self
.
_getChildren
())
def
asList
(
self
):
return
tuple
(
asList
(
self
.
getChildren
()))
def
getChildNodes
(
self
):
return
[
n
for
n
in
self
.
getChildnre
()
if
isinstance
(
n
,
Node
)]
class
EmptyNode
(
Node
):
def
__init__
(
self
):
...
...
@@ -287,6 +289,15 @@ class Mul(Node):
def
__repr__
(
self
):
return
"Mul(%s, %s)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
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
List
(
Node
):
nodes
[
"list"
]
=
"List"
def
__init__
(
self
,
nodes
):
...
...
@@ -454,14 +465,14 @@ class Power(Node):
def
__repr__
(
self
):
return
"Power(%s, %s)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Import
(
Node
):
nodes
[
"
import"
]
=
"Import
"
def
__init__
(
self
,
names
):
self
.
names
=
name
s
class
Ellipsis
(
Node
):
nodes
[
"
ellipsis"
]
=
"Ellipsis
"
def
__init__
(
self
,
):
pas
s
def
_getChildren
(
self
):
return
self
.
names
,
return
()
def
__repr__
(
self
):
return
"
Import(%s)"
%
(
repr
(
self
.
names
),)
return
"
Ellipsis()"
class
Return
(
Node
):
nodes
[
"return"
]
=
"Return"
...
...
@@ -525,14 +536,14 @@ class Subscript(Node):
def
__repr__
(
self
):
return
"Subscript(%s, %s, %s)"
%
(
repr
(
self
.
expr
),
repr
(
self
.
flags
),
repr
(
self
.
subs
))
class
Ellipsis
(
Node
):
nodes
[
"
ellipsis"
]
=
"Ellipsis
"
def
__init__
(
self
,
):
pas
s
class
Import
(
Node
):
nodes
[
"
import"
]
=
"Import
"
def
__init__
(
self
,
names
):
self
.
names
=
name
s
def
_getChildren
(
self
):
return
()
return
self
.
names
,
def
__repr__
(
self
):
return
"
Ellipsis()"
return
"
Import(%s)"
%
(
repr
(
self
.
names
),)
class
Print
(
Node
):
nodes
[
"print"
]
=
"Print"
...
...
Tools/compiler/compiler/ast.py
View file @
7713ac2f
...
...
@@ -40,6 +40,8 @@ class Node:
return
flatten
(
self
.
_getChildren
())
def
asList
(
self
):
return
tuple
(
asList
(
self
.
getChildren
()))
def
getChildNodes
(
self
):
return
[
n
for
n
in
self
.
getChildnre
()
if
isinstance
(
n
,
Node
)]
class
EmptyNode
(
Node
):
def
__init__
(
self
):
...
...
@@ -287,6 +289,15 @@ class Mul(Node):
def
__repr__
(
self
):
return
"Mul(%s, %s)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
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
List
(
Node
):
nodes
[
"list"
]
=
"List"
def
__init__
(
self
,
nodes
):
...
...
@@ -454,14 +465,14 @@ class Power(Node):
def
__repr__
(
self
):
return
"Power(%s, %s)"
%
(
repr
(
self
.
left
),
repr
(
self
.
right
))
class
Import
(
Node
):
nodes
[
"
import"
]
=
"Import
"
def
__init__
(
self
,
names
):
self
.
names
=
name
s
class
Ellipsis
(
Node
):
nodes
[
"
ellipsis"
]
=
"Ellipsis
"
def
__init__
(
self
,
):
pas
s
def
_getChildren
(
self
):
return
self
.
names
,
return
()
def
__repr__
(
self
):
return
"
Import(%s)"
%
(
repr
(
self
.
names
),)
return
"
Ellipsis()"
class
Return
(
Node
):
nodes
[
"return"
]
=
"Return"
...
...
@@ -525,14 +536,14 @@ class Subscript(Node):
def
__repr__
(
self
):
return
"Subscript(%s, %s, %s)"
%
(
repr
(
self
.
expr
),
repr
(
self
.
flags
),
repr
(
self
.
subs
))
class
Ellipsis
(
Node
):
nodes
[
"
ellipsis"
]
=
"Ellipsis
"
def
__init__
(
self
,
):
pas
s
class
Import
(
Node
):
nodes
[
"
import"
]
=
"Import
"
def
__init__
(
self
,
names
):
self
.
names
=
name
s
def
_getChildren
(
self
):
return
()
return
self
.
names
,
def
__repr__
(
self
):
return
"
Ellipsis()"
return
"
Import(%s)"
%
(
repr
(
self
.
names
),)
class
Print
(
Node
):
nodes
[
"print"
]
=
"Print"
...
...
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