summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-08-14 18:59:01 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-08-14 18:59:01 (GMT)
commit7713ac2ff1fc2950121007e58eada150f42864d6 (patch)
tree629087104999051dac3abb49ebff76b8a116c58c
parenteef65908a10f9fc7f2b69e826d324a4189e4d341 (diff)
downloadcpython-7713ac2ff1fc2950121007e58eada150f42864d6.zip
cpython-7713ac2ff1fc2950121007e58eada150f42864d6.tar.gz
cpython-7713ac2ff1fc2950121007e58eada150f42864d6.tar.bz2
Regenerated from new ast.txt and new astgen.py
-rw-r--r--Lib/compiler/ast.py35
-rw-r--r--Tools/compiler/compiler/ast.py35
2 files changed, 46 insertions, 24 deletions
diff --git a/Lib/compiler/ast.py b/Lib/compiler/ast.py
index 97689de..dda565c 100644
--- a/Lib/compiler/ast.py
+++ b/Lib/compiler/ast.py
@@ -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 = names
+class Ellipsis(Node):
+ nodes["ellipsis"] = "Ellipsis"
+ def __init__(self, ):
+ pass
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, ):
- pass
+class Import(Node):
+ nodes["import"] = "Import"
+ def __init__(self, names):
+ self.names = names
def _getChildren(self):
- return ()
+ return self.names,
def __repr__(self):
- return "Ellipsis()"
+ return "Import(%s)" % (repr(self.names),)
class Print(Node):
nodes["print"] = "Print"
diff --git a/Tools/compiler/compiler/ast.py b/Tools/compiler/compiler/ast.py
index 97689de..dda565c 100644
--- a/Tools/compiler/compiler/ast.py
+++ b/Tools/compiler/compiler/ast.py
@@ -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 = names
+class Ellipsis(Node):
+ nodes["ellipsis"] = "Ellipsis"
+ def __init__(self, ):
+ pass
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, ):
- pass
+class Import(Node):
+ nodes["import"] = "Import"
+ def __init__(self, names):
+ self.names = names
def _getChildren(self):
- return ()
+ return self.names,
def __repr__(self):
- return "Ellipsis()"
+ return "Import(%s)" % (repr(self.names),)
class Print(Node):
nodes["print"] = "Print"