2000-10-25 15:02:59 -03:00
|
|
|
"""Python abstract syntax node definitions
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
This file is automatically generated.
|
|
|
|
"""
|
|
|
|
from types import TupleType, ListType
|
|
|
|
from consts import CO_VARARGS, CO_VARKEYWORDS
|
2000-02-03 20:25:23 -04:00
|
|
|
|
|
|
|
def flatten(list):
|
2000-10-25 15:02:59 -03:00
|
|
|
l = []
|
|
|
|
for elt in list:
|
|
|
|
t = type(elt)
|
|
|
|
if t is TupleType or t is ListType:
|
|
|
|
for elt2 in flatten(elt):
|
|
|
|
l.append(elt2)
|
|
|
|
else:
|
|
|
|
l.append(elt)
|
|
|
|
return l
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-08-29 15:08:02 -03:00
|
|
|
def flatten_nodes(list):
|
|
|
|
return [n for n in flatten(list) if isinstance(n, Node)]
|
|
|
|
|
2000-02-03 20:25:23 -04:00
|
|
|
def asList(nodes):
|
2000-10-25 15:02:59 -03:00
|
|
|
l = []
|
|
|
|
for item in nodes:
|
|
|
|
if hasattr(item, "asList"):
|
|
|
|
l.append(item.asList())
|
|
|
|
else:
|
|
|
|
t = type(item)
|
|
|
|
if t is TupleType or t is ListType:
|
|
|
|
l.append(tuple(asList(item)))
|
|
|
|
else:
|
|
|
|
l.append(item)
|
|
|
|
return l
|
|
|
|
|
|
|
|
nodes = {}
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-08-29 15:08:02 -03:00
|
|
|
class Node: # an abstract base class
|
|
|
|
lineno = None # provide a lineno for nodes that don't have one
|
2000-10-25 15:02:59 -03:00
|
|
|
def getType(self):
|
2001-08-29 15:08:02 -03:00
|
|
|
pass # implemented by subclass
|
2000-10-25 15:02:59 -03:00
|
|
|
def getChildren(self):
|
2001-08-29 15:08:02 -03:00
|
|
|
pass # implemented by subclasses
|
2000-10-25 15:02:59 -03:00
|
|
|
def asList(self):
|
|
|
|
return tuple(asList(self.getChildren()))
|
2001-08-14 15:59:01 -03:00
|
|
|
def getChildNodes(self):
|
2001-08-29 15:08:02 -03:00
|
|
|
pass # implemented by subclasses
|
2000-02-03 20:25:23 -04:00
|
|
|
|
|
|
|
class EmptyNode(Node):
|
2001-08-29 15:08:02 -03:00
|
|
|
pass
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Slice(Node):
|
|
|
|
nodes["slice"] = "Slice"
|
|
|
|
def __init__(self, expr, flags, lower, upper):
|
|
|
|
self.expr = expr
|
|
|
|
self.flags = flags
|
|
|
|
self.lower = lower
|
|
|
|
self.upper = upper
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
2001-09-17 17:17:02 -03:00
|
|
|
children.append(self.expr)
|
|
|
|
children.append(self.flags)
|
|
|
|
children.append(self.lower)
|
|
|
|
children.append(self.upper)
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes.append(self.expr)
|
|
|
|
if self.lower is not None: nodes.append(self.lower)
|
|
|
|
if self.upper is not None: nodes.append(self.upper)
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Slice(%s, %s, %s, %s)" % (repr(self.expr), repr(self.flags), repr(self.lower), repr(self.upper))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Const(Node):
|
|
|
|
nodes["const"] = "Const"
|
|
|
|
def __init__(self, value):
|
|
|
|
self.value = value
|
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
return self.value,
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
return ()
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return "Const(%s)" % (repr(self.value),)
|
|
|
|
|
|
|
|
class Raise(Node):
|
|
|
|
nodes["raise"] = "Raise"
|
|
|
|
def __init__(self, expr1, expr2, expr3):
|
|
|
|
self.expr1 = expr1
|
|
|
|
self.expr2 = expr2
|
|
|
|
self.expr3 = expr3
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
2001-09-17 17:17:02 -03:00
|
|
|
children.append(self.expr1)
|
|
|
|
children.append(self.expr2)
|
|
|
|
children.append(self.expr3)
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
if self.expr1 is not None: nodes.append(self.expr1)
|
|
|
|
if self.expr2 is not None: nodes.append(self.expr2)
|
|
|
|
if self.expr3 is not None: nodes.append(self.expr3)
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Raise(%s, %s, %s)" % (repr(self.expr1), repr(self.expr2), repr(self.expr3))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class For(Node):
|
|
|
|
nodes["for"] = "For"
|
|
|
|
def __init__(self, assign, list, body, else_):
|
|
|
|
self.assign = assign
|
|
|
|
self.list = list
|
|
|
|
self.body = body
|
|
|
|
self.else_ = else_
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
2001-09-17 17:17:02 -03:00
|
|
|
children.append(self.assign)
|
|
|
|
children.append(self.list)
|
|
|
|
children.append(self.body)
|
|
|
|
children.append(self.else_)
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes.append(self.assign)
|
|
|
|
nodes.append(self.list)
|
|
|
|
nodes.append(self.body)
|
|
|
|
if self.else_ is not None: nodes.append(self.else_)
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "For(%s, %s, %s, %s)" % (repr(self.assign), repr(self.list), repr(self.body), repr(self.else_))
|
2000-10-25 15:02:59 -03:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class AssTuple(Node):
|
|
|
|
nodes["asstuple"] = "AssTuple"
|
|
|
|
def __init__(self, nodes):
|
|
|
|
self.nodes = nodes
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
children = []
|
|
|
|
children.extend(flatten(self.nodes))
|
|
|
|
return tuple(children)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes = []
|
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "AssTuple(%s)" % (repr(self.nodes),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Mul(Node):
|
|
|
|
nodes["mul"] = "Mul"
|
|
|
|
def __init__(self, (left, right)):
|
|
|
|
self.left = left
|
|
|
|
self.right = right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.left, self.right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.left, self.right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Mul((%s, %s))" % (repr(self.left), repr(self.right))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Invert(Node):
|
|
|
|
nodes["invert"] = "Invert"
|
|
|
|
def __init__(self, expr):
|
|
|
|
self.expr = expr
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.expr,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.expr,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Invert(%s)" % (repr(self.expr),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class RightShift(Node):
|
|
|
|
nodes["rightshift"] = "RightShift"
|
|
|
|
def __init__(self, (left, right)):
|
|
|
|
self.left = left
|
|
|
|
self.right = right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.left, self.right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.left, self.right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "RightShift((%s, %s))" % (repr(self.left), repr(self.right))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class AssList(Node):
|
|
|
|
nodes["asslist"] = "AssList"
|
|
|
|
def __init__(self, nodes):
|
2000-10-25 15:02:59 -03:00
|
|
|
self.nodes = nodes
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
|
|
|
children.extend(flatten(self.nodes))
|
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "AssList(%s)" % (repr(self.nodes),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class From(Node):
|
|
|
|
nodes["from"] = "From"
|
|
|
|
def __init__(self, modname, names):
|
|
|
|
self.modname = modname
|
|
|
|
self.names = names
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.modname, self.names
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return ()
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "From(%s, %s)" % (repr(self.modname), repr(self.names))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Getattr(Node):
|
|
|
|
nodes["getattr"] = "Getattr"
|
|
|
|
def __init__(self, expr, attrname):
|
2000-10-25 15:02:59 -03:00
|
|
|
self.expr = expr
|
2001-09-17 17:17:02 -03:00
|
|
|
self.attrname = attrname
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.expr, self.attrname
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.expr,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Getattr(%s, %s)" % (repr(self.expr), repr(self.attrname))
|
2000-10-13 18:58:13 -03:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Dict(Node):
|
|
|
|
nodes["dict"] = "Dict"
|
|
|
|
def __init__(self, items):
|
|
|
|
self.items = items
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
2001-09-17 17:17:02 -03:00
|
|
|
children.extend(flatten(self.items))
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes.extend(flatten_nodes(self.items))
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Dict(%s)" % (repr(self.items),)
|
2000-10-25 15:02:59 -03:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Module(Node):
|
|
|
|
nodes["module"] = "Module"
|
|
|
|
def __init__(self, doc, node):
|
|
|
|
self.doc = doc
|
|
|
|
self.node = node
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.doc, self.node
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.node,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Module(%s, %s)" % (repr(self.doc), repr(self.node))
|
2000-10-13 18:58:13 -03:00
|
|
|
|
2001-12-21 16:04:22 -04:00
|
|
|
class Expression(Node):
|
|
|
|
# Expression is an artifical node class to support "eval"
|
|
|
|
nodes["expression"] = "Expression"
|
|
|
|
def __init__(self, node):
|
|
|
|
self.node = node
|
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
return self.node,
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
return self.node,
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return "Expression(%s)" % (repr(self.node))
|
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class UnaryAdd(Node):
|
|
|
|
nodes["unaryadd"] = "UnaryAdd"
|
|
|
|
def __init__(self, expr):
|
2000-10-25 15:02:59 -03:00
|
|
|
self.expr = expr
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.expr,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.expr,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "UnaryAdd(%s)" % (repr(self.expr),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Ellipsis(Node):
|
|
|
|
nodes["ellipsis"] = "Ellipsis"
|
|
|
|
def __init__(self, ):
|
|
|
|
pass
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return ()
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return ()
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Ellipsis()"
|
2000-10-13 18:58:13 -03:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Print(Node):
|
|
|
|
nodes["print"] = "Print"
|
|
|
|
def __init__(self, nodes, dest):
|
|
|
|
self.nodes = nodes
|
|
|
|
self.dest = dest
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
children = []
|
|
|
|
children.extend(flatten(self.nodes))
|
|
|
|
children.append(self.dest)
|
|
|
|
return tuple(children)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes = []
|
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
|
|
|
if self.dest is not None: nodes.append(self.dest)
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Print(%s, %s)" % (repr(self.nodes), repr(self.dest))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Import(Node):
|
|
|
|
nodes["import"] = "Import"
|
|
|
|
def __init__(self, names):
|
|
|
|
self.names = names
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.names,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return ()
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Import(%s)" % (repr(self.names),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Subscript(Node):
|
|
|
|
nodes["subscript"] = "Subscript"
|
|
|
|
def __init__(self, expr, flags, subs):
|
2000-10-25 15:02:59 -03:00
|
|
|
self.expr = expr
|
2001-09-17 17:17:02 -03:00
|
|
|
self.flags = flags
|
|
|
|
self.subs = subs
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
children = []
|
|
|
|
children.append(self.expr)
|
|
|
|
children.append(self.flags)
|
|
|
|
children.extend(flatten(self.subs))
|
|
|
|
return tuple(children)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes = []
|
|
|
|
nodes.append(self.expr)
|
|
|
|
nodes.extend(flatten_nodes(self.subs))
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Subscript(%s, %s, %s)" % (repr(self.expr), repr(self.flags), repr(self.subs))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class TryExcept(Node):
|
|
|
|
nodes["tryexcept"] = "TryExcept"
|
|
|
|
def __init__(self, body, handlers, else_):
|
|
|
|
self.body = body
|
|
|
|
self.handlers = handlers
|
|
|
|
self.else_ = else_
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
children = []
|
|
|
|
children.append(self.body)
|
|
|
|
children.extend(flatten(self.handlers))
|
|
|
|
children.append(self.else_)
|
|
|
|
return tuple(children)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes = []
|
|
|
|
nodes.append(self.body)
|
|
|
|
nodes.extend(flatten_nodes(self.handlers))
|
|
|
|
if self.else_ is not None: nodes.append(self.else_)
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "TryExcept(%s, %s, %s)" % (repr(self.body), repr(self.handlers), repr(self.else_))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Or(Node):
|
|
|
|
nodes["or"] = "Or"
|
|
|
|
def __init__(self, nodes):
|
|
|
|
self.nodes = nodes
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
children = []
|
|
|
|
children.extend(flatten(self.nodes))
|
|
|
|
return tuple(children)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes = []
|
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Or(%s)" % (repr(self.nodes),)
|
|
|
|
|
|
|
|
class Name(Node):
|
|
|
|
nodes["name"] = "Name"
|
|
|
|
def __init__(self, name):
|
|
|
|
self.name = name
|
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
return self.name,
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
return ()
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return "Name(%s)" % (repr(self.name),)
|
|
|
|
|
|
|
|
class Function(Node):
|
|
|
|
nodes["function"] = "Function"
|
|
|
|
def __init__(self, name, argnames, defaults, flags, doc, code):
|
|
|
|
self.name = name
|
|
|
|
self.argnames = argnames
|
|
|
|
self.defaults = defaults
|
|
|
|
self.flags = flags
|
|
|
|
self.doc = doc
|
|
|
|
self.code = code
|
|
|
|
self.varargs = self.kwargs = None
|
|
|
|
if flags & CO_VARARGS:
|
|
|
|
self.varargs = 1
|
|
|
|
if flags & CO_VARKEYWORDS:
|
|
|
|
self.kwargs = 1
|
2001-10-18 18:57:37 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
children = []
|
|
|
|
children.append(self.name)
|
|
|
|
children.append(self.argnames)
|
|
|
|
children.extend(flatten(self.defaults))
|
|
|
|
children.append(self.flags)
|
|
|
|
children.append(self.doc)
|
|
|
|
children.append(self.code)
|
|
|
|
return tuple(children)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes = []
|
|
|
|
nodes.extend(flatten_nodes(self.defaults))
|
|
|
|
nodes.append(self.code)
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Function(%s, %s, %s, %s, %s, %s)" % (repr(self.name), repr(self.argnames), repr(self.defaults), repr(self.flags), repr(self.doc), repr(self.code))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Assert(Node):
|
|
|
|
nodes["assert"] = "Assert"
|
|
|
|
def __init__(self, test, fail):
|
2000-10-25 15:02:59 -03:00
|
|
|
self.test = test
|
2001-09-17 17:17:02 -03:00
|
|
|
self.fail = fail
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
|
|
|
children.append(self.test)
|
2001-09-17 17:17:02 -03:00
|
|
|
children.append(self.fail)
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
|
|
|
nodes.append(self.test)
|
2001-09-17 17:17:02 -03:00
|
|
|
if self.fail is not None: nodes.append(self.fail)
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Assert(%s, %s)" % (repr(self.test), repr(self.fail))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Return(Node):
|
|
|
|
nodes["return"] = "Return"
|
|
|
|
def __init__(self, value):
|
|
|
|
self.value = value
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.value,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.value,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Return(%s)" % (repr(self.value),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Power(Node):
|
|
|
|
nodes["power"] = "Power"
|
2000-10-25 15:02:59 -03:00
|
|
|
def __init__(self, (left, right)):
|
|
|
|
self.left = left
|
|
|
|
self.right = right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
return self.left, self.right
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
2000-10-25 15:02:59 -03:00
|
|
|
return self.left, self.right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Power((%s, %s))" % (repr(self.left), repr(self.right))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Exec(Node):
|
|
|
|
nodes["exec"] = "Exec"
|
|
|
|
def __init__(self, expr, locals, globals):
|
|
|
|
self.expr = expr
|
|
|
|
self.locals = locals
|
|
|
|
self.globals = globals
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
children = []
|
|
|
|
children.append(self.expr)
|
|
|
|
children.append(self.locals)
|
|
|
|
children.append(self.globals)
|
|
|
|
return tuple(children)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes = []
|
|
|
|
nodes.append(self.expr)
|
|
|
|
if self.locals is not None: nodes.append(self.locals)
|
|
|
|
if self.globals is not None: nodes.append(self.globals)
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2001-08-14 15:59:01 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Exec(%s, %s, %s)" % (repr(self.expr), repr(self.locals), repr(self.globals))
|
2001-08-14 15:59:01 -03:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Stmt(Node):
|
|
|
|
nodes["stmt"] = "Stmt"
|
2000-10-25 15:02:59 -03:00
|
|
|
def __init__(self, nodes):
|
|
|
|
self.nodes = nodes
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
|
|
|
children.extend(flatten(self.nodes))
|
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Stmt(%s)" % (repr(self.nodes),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Sliceobj(Node):
|
|
|
|
nodes["sliceobj"] = "Sliceobj"
|
2000-10-25 15:02:59 -03:00
|
|
|
def __init__(self, nodes):
|
|
|
|
self.nodes = nodes
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
|
|
|
children.extend(flatten(self.nodes))
|
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Sliceobj(%s)" % (repr(self.nodes),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Break(Node):
|
|
|
|
nodes["break"] = "Break"
|
|
|
|
def __init__(self, ):
|
|
|
|
pass
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return ()
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return ()
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Break()"
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Bitand(Node):
|
|
|
|
nodes["bitand"] = "Bitand"
|
|
|
|
def __init__(self, nodes):
|
|
|
|
self.nodes = nodes
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
children = []
|
|
|
|
children.extend(flatten(self.nodes))
|
|
|
|
return tuple(children)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes = []
|
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Bitand(%s)" % (repr(self.nodes),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class FloorDiv(Node):
|
|
|
|
nodes["floordiv"] = "FloorDiv"
|
2000-10-25 15:02:59 -03:00
|
|
|
def __init__(self, (left, right)):
|
|
|
|
self.left = left
|
|
|
|
self.right = right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
return self.left, self.right
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
2000-10-25 15:02:59 -03:00
|
|
|
return self.left, self.right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "FloorDiv((%s, %s))" % (repr(self.left), repr(self.right))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class TryFinally(Node):
|
|
|
|
nodes["tryfinally"] = "TryFinally"
|
|
|
|
def __init__(self, body, final):
|
|
|
|
self.body = body
|
|
|
|
self.final = final
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.body, self.final
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.body, self.final
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "TryFinally(%s, %s)" % (repr(self.body), repr(self.final))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
class Not(Node):
|
|
|
|
nodes["not"] = "Not"
|
|
|
|
def __init__(self, expr):
|
|
|
|
self.expr = expr
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
return self.expr,
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
2000-10-25 15:02:59 -03:00
|
|
|
return self.expr,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
|
|
|
return "Not(%s)" % (repr(self.expr),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Class(Node):
|
|
|
|
nodes["class"] = "Class"
|
|
|
|
def __init__(self, name, bases, doc, code):
|
|
|
|
self.name = name
|
|
|
|
self.bases = bases
|
|
|
|
self.doc = doc
|
|
|
|
self.code = code
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
2001-09-17 17:17:02 -03:00
|
|
|
children.append(self.name)
|
|
|
|
children.extend(flatten(self.bases))
|
|
|
|
children.append(self.doc)
|
|
|
|
children.append(self.code)
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes.extend(flatten_nodes(self.bases))
|
|
|
|
nodes.append(self.code)
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Class(%s, %s, %s, %s)" % (repr(self.name), repr(self.bases), repr(self.doc), repr(self.code))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Mod(Node):
|
|
|
|
nodes["mod"] = "Mod"
|
2001-08-29 15:08:02 -03:00
|
|
|
def __init__(self, (left, right)):
|
|
|
|
self.left = left
|
|
|
|
self.right = right
|
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
return self.left, self.right
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
return self.left, self.right
|
|
|
|
|
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Mod((%s, %s))" % (repr(self.left), repr(self.right))
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Printnl(Node):
|
|
|
|
nodes["printnl"] = "Printnl"
|
|
|
|
def __init__(self, nodes, dest):
|
2000-10-25 15:02:59 -03:00
|
|
|
self.nodes = nodes
|
2001-09-17 17:17:02 -03:00
|
|
|
self.dest = dest
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
|
|
|
children.extend(flatten(self.nodes))
|
2001-09-17 17:17:02 -03:00
|
|
|
children.append(self.dest)
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
|
|
|
if self.dest is not None: nodes.append(self.dest)
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Printnl(%s, %s)" % (repr(self.nodes), repr(self.dest))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Tuple(Node):
|
|
|
|
nodes["tuple"] = "Tuple"
|
2000-10-25 15:02:59 -03:00
|
|
|
def __init__(self, nodes):
|
|
|
|
self.nodes = nodes
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
|
|
|
children.extend(flatten(self.nodes))
|
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Tuple(%s)" % (repr(self.nodes),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class AssAttr(Node):
|
|
|
|
nodes["assattr"] = "AssAttr"
|
|
|
|
def __init__(self, expr, attrname, flags):
|
|
|
|
self.expr = expr
|
|
|
|
self.attrname = attrname
|
|
|
|
self.flags = flags
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.expr, self.attrname, self.flags
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.expr,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "AssAttr(%s, %s, %s)" % (repr(self.expr), repr(self.attrname), repr(self.flags))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Keyword(Node):
|
|
|
|
nodes["keyword"] = "Keyword"
|
|
|
|
def __init__(self, name, expr):
|
|
|
|
self.name = name
|
2000-10-25 15:02:59 -03:00
|
|
|
self.expr = expr
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.name, self.expr
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.expr,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Keyword(%s, %s)" % (repr(self.name), repr(self.expr))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class AugAssign(Node):
|
|
|
|
nodes["augassign"] = "AugAssign"
|
|
|
|
def __init__(self, node, op, expr):
|
|
|
|
self.node = node
|
|
|
|
self.op = op
|
|
|
|
self.expr = expr
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.node, self.op, self.expr
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.node, self.expr
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "AugAssign(%s, %s, %s)" % (repr(self.node), repr(self.op), repr(self.expr))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class List(Node):
|
|
|
|
nodes["list"] = "List"
|
|
|
|
def __init__(self, nodes):
|
|
|
|
self.nodes = nodes
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
children = []
|
|
|
|
children.extend(flatten(self.nodes))
|
|
|
|
return tuple(children)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes = []
|
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "List(%s)" % (repr(self.nodes),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Yield(Node):
|
|
|
|
nodes["yield"] = "Yield"
|
2000-10-25 15:02:59 -03:00
|
|
|
def __init__(self, value):
|
|
|
|
self.value = value
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
return self.value,
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
2000-10-25 15:02:59 -03:00
|
|
|
return self.value,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Yield(%s)" % (repr(self.value),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class LeftShift(Node):
|
|
|
|
nodes["leftshift"] = "LeftShift"
|
2000-10-25 15:02:59 -03:00
|
|
|
def __init__(self, (left, right)):
|
|
|
|
self.left = left
|
|
|
|
self.right = right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2000-10-25 15:02:59 -03:00
|
|
|
return self.left, self.right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
return self.left, self.right
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "LeftShift((%s, %s))" % (repr(self.left), repr(self.right))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class AssName(Node):
|
|
|
|
nodes["assname"] = "AssName"
|
|
|
|
def __init__(self, name, flags):
|
2000-10-25 15:02:59 -03:00
|
|
|
self.name = name
|
|
|
|
self.flags = flags
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.name, self.flags
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return ()
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "AssName(%s, %s)" % (repr(self.name), repr(self.flags))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class While(Node):
|
|
|
|
nodes["while"] = "While"
|
|
|
|
def __init__(self, test, body, else_):
|
|
|
|
self.test = test
|
2000-10-25 15:02:59 -03:00
|
|
|
self.body = body
|
|
|
|
self.else_ = else_
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
2001-09-17 17:17:02 -03:00
|
|
|
children.append(self.test)
|
2001-08-29 15:08:02 -03:00
|
|
|
children.append(self.body)
|
|
|
|
children.append(self.else_)
|
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes.append(self.test)
|
2001-08-29 15:08:02 -03:00
|
|
|
nodes.append(self.body)
|
|
|
|
if self.else_ is not None: nodes.append(self.else_)
|
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "While(%s, %s, %s)" % (repr(self.test), repr(self.body), repr(self.else_))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Continue(Node):
|
|
|
|
nodes["continue"] = "Continue"
|
|
|
|
def __init__(self, ):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
return ()
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
return ()
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return "Continue()"
|
|
|
|
|
|
|
|
class Backquote(Node):
|
|
|
|
nodes["backquote"] = "Backquote"
|
|
|
|
def __init__(self, expr):
|
|
|
|
self.expr = expr
|
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
return self.expr,
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
return self.expr,
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return "Backquote(%s)" % (repr(self.expr),)
|
|
|
|
|
|
|
|
class Discard(Node):
|
|
|
|
nodes["discard"] = "Discard"
|
|
|
|
def __init__(self, expr):
|
|
|
|
self.expr = expr
|
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
return self.expr,
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
return self.expr,
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return "Discard(%s)" % (repr(self.expr),)
|
|
|
|
|
|
|
|
class Div(Node):
|
|
|
|
nodes["div"] = "Div"
|
|
|
|
def __init__(self, (left, right)):
|
|
|
|
self.left = left
|
|
|
|
self.right = right
|
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
return self.left, self.right
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
return self.left, self.right
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return "Div((%s, %s))" % (repr(self.left), repr(self.right))
|
|
|
|
|
|
|
|
class Assign(Node):
|
|
|
|
nodes["assign"] = "Assign"
|
|
|
|
def __init__(self, nodes, expr):
|
|
|
|
self.nodes = nodes
|
2000-10-25 15:02:59 -03:00
|
|
|
self.expr = expr
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
2001-09-17 17:17:02 -03:00
|
|
|
children.extend(flatten(self.nodes))
|
2001-08-29 15:08:02 -03:00
|
|
|
children.append(self.expr)
|
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
2001-08-29 15:08:02 -03:00
|
|
|
nodes.append(self.expr)
|
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Assign(%s, %s)" % (repr(self.nodes), repr(self.expr))
|
|
|
|
|
|
|
|
class Lambda(Node):
|
|
|
|
nodes["lambda"] = "Lambda"
|
|
|
|
def __init__(self, argnames, defaults, flags, code):
|
|
|
|
self.argnames = argnames
|
|
|
|
self.defaults = defaults
|
|
|
|
self.flags = flags
|
|
|
|
self.code = code
|
|
|
|
self.varargs = self.kwargs = None
|
|
|
|
if flags & CO_VARARGS:
|
|
|
|
self.varargs = 1
|
|
|
|
if flags & CO_VARKEYWORDS:
|
|
|
|
self.kwargs = 1
|
2000-10-25 15:02:59 -03:00
|
|
|
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
children = []
|
|
|
|
children.append(self.argnames)
|
|
|
|
children.extend(flatten(self.defaults))
|
|
|
|
children.append(self.flags)
|
|
|
|
children.append(self.code)
|
|
|
|
return tuple(children)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes = []
|
|
|
|
nodes.extend(flatten_nodes(self.defaults))
|
|
|
|
nodes.append(self.code)
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Lambda(%s, %s, %s, %s)" % (repr(self.argnames), repr(self.defaults), repr(self.flags), repr(self.code))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class And(Node):
|
|
|
|
nodes["and"] = "And"
|
|
|
|
def __init__(self, nodes):
|
2000-10-25 15:02:59 -03:00
|
|
|
self.nodes = nodes
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
|
|
|
children.extend(flatten(self.nodes))
|
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "And(%s)" % (repr(self.nodes),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Compare(Node):
|
|
|
|
nodes["compare"] = "Compare"
|
|
|
|
def __init__(self, expr, ops):
|
2000-10-25 15:02:59 -03:00
|
|
|
self.expr = expr
|
2001-09-17 17:17:02 -03:00
|
|
|
self.ops = ops
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
children = []
|
|
|
|
children.append(self.expr)
|
|
|
|
children.extend(flatten(self.ops))
|
|
|
|
return tuple(children)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes = []
|
|
|
|
nodes.append(self.expr)
|
|
|
|
nodes.extend(flatten_nodes(self.ops))
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Compare(%s, %s)" % (repr(self.expr), repr(self.ops))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Bitor(Node):
|
|
|
|
nodes["bitor"] = "Bitor"
|
|
|
|
def __init__(self, nodes):
|
|
|
|
self.nodes = nodes
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
2001-09-17 17:17:02 -03:00
|
|
|
children.extend(flatten(self.nodes))
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Bitor(%s)" % (repr(self.nodes),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Bitxor(Node):
|
|
|
|
nodes["bitxor"] = "Bitxor"
|
|
|
|
def __init__(self, nodes):
|
|
|
|
self.nodes = nodes
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
2001-09-17 17:17:02 -03:00
|
|
|
children.extend(flatten(self.nodes))
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes.extend(flatten_nodes(self.nodes))
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Bitxor(%s)" % (repr(self.nodes),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class CallFunc(Node):
|
|
|
|
nodes["callfunc"] = "CallFunc"
|
|
|
|
def __init__(self, node, args, star_args = None, dstar_args = None):
|
|
|
|
self.node = node
|
|
|
|
self.args = args
|
|
|
|
self.star_args = star_args
|
|
|
|
self.dstar_args = dstar_args
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
children = []
|
|
|
|
children.append(self.node)
|
|
|
|
children.extend(flatten(self.args))
|
|
|
|
children.append(self.star_args)
|
|
|
|
children.append(self.dstar_args)
|
|
|
|
return tuple(children)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes = []
|
|
|
|
nodes.append(self.node)
|
|
|
|
nodes.extend(flatten_nodes(self.args))
|
|
|
|
if self.star_args is not None: nodes.append(self.star_args)
|
|
|
|
if self.dstar_args is not None: nodes.append(self.dstar_args)
|
|
|
|
return tuple(nodes)
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "CallFunc(%s, %s, %s, %s)" % (repr(self.node), repr(self.args), repr(self.star_args), repr(self.dstar_args))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Global(Node):
|
|
|
|
nodes["global"] = "Global"
|
|
|
|
def __init__(self, names):
|
|
|
|
self.names = names
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.names,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return ()
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Global(%s)" % (repr(self.names),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Add(Node):
|
|
|
|
nodes["add"] = "Add"
|
|
|
|
def __init__(self, (left, right)):
|
|
|
|
self.left = left
|
|
|
|
self.right = right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.left, self.right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.left, self.right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Add((%s, %s))" % (repr(self.left), repr(self.right))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class ListCompIf(Node):
|
|
|
|
nodes["listcompif"] = "ListCompIf"
|
|
|
|
def __init__(self, test):
|
|
|
|
self.test = test
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.test,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.test,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "ListCompIf(%s)" % (repr(self.test),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Sub(Node):
|
|
|
|
nodes["sub"] = "Sub"
|
|
|
|
def __init__(self, (left, right)):
|
|
|
|
self.left = left
|
|
|
|
self.right = right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.left, self.right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.left, self.right
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Sub((%s, %s))" % (repr(self.left), repr(self.right))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class Pass(Node):
|
|
|
|
nodes["pass"] = "Pass"
|
|
|
|
def __init__(self, ):
|
|
|
|
pass
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return ()
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
return ()
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "Pass()"
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class UnarySub(Node):
|
|
|
|
nodes["unarysub"] = "UnarySub"
|
|
|
|
def __init__(self, expr):
|
|
|
|
self.expr = expr
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.expr,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildNodes(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return self.expr,
|
2001-08-29 15:08:02 -03:00
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "UnarySub(%s)" % (repr(self.expr),)
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class If(Node):
|
|
|
|
nodes["if"] = "If"
|
|
|
|
def __init__(self, tests, else_):
|
|
|
|
self.tests = tests
|
2000-10-25 15:02:59 -03:00
|
|
|
self.else_ = else_
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
2001-09-17 17:17:02 -03:00
|
|
|
children.extend(flatten(self.tests))
|
2001-08-29 15:08:02 -03:00
|
|
|
children.append(self.else_)
|
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes.extend(flatten_nodes(self.tests))
|
2001-08-29 15:08:02 -03:00
|
|
|
if self.else_ is not None: nodes.append(self.else_)
|
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "If(%s, %s)" % (repr(self.tests), repr(self.else_))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class ListComp(Node):
|
|
|
|
nodes["listcomp"] = "ListComp"
|
|
|
|
def __init__(self, expr, quals):
|
|
|
|
self.expr = expr
|
|
|
|
self.quals = quals
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
2001-09-17 17:17:02 -03:00
|
|
|
children.append(self.expr)
|
|
|
|
children.extend(flatten(self.quals))
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes.append(self.expr)
|
|
|
|
nodes.extend(flatten_nodes(self.quals))
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "ListComp(%s, %s)" % (repr(self.expr), repr(self.quals))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
2001-09-17 17:17:02 -03:00
|
|
|
class ListCompFor(Node):
|
|
|
|
nodes["listcompfor"] = "ListCompFor"
|
|
|
|
def __init__(self, assign, list, ifs):
|
|
|
|
self.assign = assign
|
|
|
|
self.list = list
|
|
|
|
self.ifs = ifs
|
2001-08-29 15:08:02 -03:00
|
|
|
|
|
|
|
def getChildren(self):
|
|
|
|
children = []
|
2001-09-17 17:17:02 -03:00
|
|
|
children.append(self.assign)
|
|
|
|
children.append(self.list)
|
|
|
|
children.extend(flatten(self.ifs))
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(children)
|
|
|
|
|
|
|
|
def getChildNodes(self):
|
|
|
|
nodes = []
|
2001-09-17 17:17:02 -03:00
|
|
|
nodes.append(self.assign)
|
|
|
|
nodes.append(self.list)
|
|
|
|
nodes.extend(flatten_nodes(self.ifs))
|
2001-08-29 15:08:02 -03:00
|
|
|
return tuple(nodes)
|
|
|
|
|
2000-10-25 15:02:59 -03:00
|
|
|
def __repr__(self):
|
2001-09-17 17:17:02 -03:00
|
|
|
return "ListCompFor(%s, %s, %s)" % (repr(self.assign), repr(self.list), repr(self.ifs))
|
2000-02-03 20:25:23 -04:00
|
|
|
|
|
|
|
klasses = globals()
|
|
|
|
for k in nodes.keys():
|
2000-10-25 15:02:59 -03:00
|
|
|
nodes[k] = klasses[nodes[k]]
|