From 7713ac2ff1fc2950121007e58eada150f42864d6 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Tue, 14 Aug 2001 18:59:01 +0000 Subject: Regenerated from new ast.txt and new astgen.py --- Lib/compiler/ast.py | 35 +++++++++++++++++++++++------------ Tools/compiler/compiler/ast.py | 35 +++++++++++++++++++++++------------ 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" -- cgit v0.12