blob: 2ff1223cbdd93cb45167cd2b95664e15e38e4ac8 [file] [log] [blame]
Jeremy Hylton5477f522001-08-29 18:08:02 +00001# This file describes the nodes of the AST in ast.py. The module is
2# generated by astgen.py.
3# The descriptions use the following special notation to describe
4# properties of the children:
5# * this child is not a node
6# ! this child is a sequence that contains nodes in it
7# & this child may be set to None
8# = ... a default value for the node constructor (optional args)
Andrew M. Kuchlinga6d4b682005-11-22 15:01:13 +00009#
10# If you add node types here, please be sure to update the list of
11# Node types in Doc/lib/asttable.tex.
Jeremy Hylton5477f522001-08-29 18:08:02 +000012Module: doc*, node
13Stmt: nodes!
Anthony Baxterc2a5a632004-08-02 06:10:11 +000014Decorators: nodes!
Neal Norwitzc1505362006-12-28 06:47:50 +000015Function: decorators&, name*, arguments!, defaults!, kwonlyargs!, returns&, flags*, doc*, code
16Lambda: arguments!, defaults!, kwonlyargs!, flags*, code
17SimpleArg: name*, annotation&
18NestedArgs: args!
19Kwarg: arg, expr
Jeremy Hylton5477f522001-08-29 18:08:02 +000020Class: name*, bases!, doc*, code
Jeremy Hylton821eee32000-10-25 17:59:17 +000021Pass:
22Break:
23Continue:
Jeremy Hylton5477f522001-08-29 18:08:02 +000024For: assign, list, body, else_&
25While: test, body, else_&
Guido van Rossumc2e20742006-02-27 22:32:47 +000026With: expr, vars&, body
Jeremy Hylton5477f522001-08-29 18:08:02 +000027If: tests!, else_&
Thomas Wouters7e2ac252006-03-03 18:11:37 +000028IfExp: test, then, else_
Thomas Wouters7e2ac252006-03-03 18:11:37 +000029From: modname*, names*, level*
Jeremy Hylton5477f522001-08-29 18:08:02 +000030Import: names*
31Raise: expr1&, expr2&, expr3&
Jeremy Hylton821eee32000-10-25 17:59:17 +000032TryFinally: body, final
Jeremy Hylton5477f522001-08-29 18:08:02 +000033TryExcept: body, handlers!, else_&
Jeremy Hylton821eee32000-10-25 17:59:17 +000034Return: value
Jeremy Hylton34aeeff2001-08-14 18:57:43 +000035Yield: value
Jeremy Hylton5477f522001-08-29 18:08:02 +000036Const: value*
37Print: nodes!, dest&
38Printnl: nodes!, dest&
Jeremy Hylton821eee32000-10-25 17:59:17 +000039Discard: expr
Jeremy Hylton5477f522001-08-29 18:08:02 +000040AugAssign: node, op*, expr
41Assign: nodes!, expr
42AssTuple: nodes!
43AssList: nodes!
44AssName: name*, flags*
45AssAttr: expr, attrname*, flags*
46ListComp: expr, quals!
47ListCompFor: assign, list, ifs!
Jeremy Hylton821eee32000-10-25 17:59:17 +000048ListCompIf: test
Guido van Rossumc2e20742006-02-27 22:32:47 +000049GenExpr: code
Raymond Hettinger354433a2004-05-19 08:20:33 +000050GenExprInner: expr, quals!
51GenExprFor: assign, iter, ifs!
52GenExprIf: test
Jeremy Hylton5477f522001-08-29 18:08:02 +000053List: nodes!
54Dict: items!
Guido van Rossum86e58e22006-08-28 15:27:34 +000055Set: items!
Jeremy Hylton821eee32000-10-25 17:59:17 +000056Not: expr
Jeremy Hylton5477f522001-08-29 18:08:02 +000057Compare: expr, ops!
58Name: name*
Jeremy Hyltonfff252d2001-09-14 22:40:36 +000059Global: names*
Jeremy Hylton5477f522001-08-29 18:08:02 +000060Getattr: expr, attrname*
61CallFunc: node, args!, star_args& = None, dstar_args& = None
62Keyword: name*, expr
63Subscript: expr, flags*, subs!
Jeremy Hylton5477f522001-08-29 18:08:02 +000064Sliceobj: nodes!
65Slice: expr, flags*, lower&, upper&
66Assert: test, fail&
67Tuple: nodes!
68Or: nodes!
69And: nodes!
70Bitor: nodes!
71Bitxor: nodes!
72Bitand: nodes!
Jeremy Hylton821eee32000-10-25 17:59:17 +000073LeftShift: (left, right)
74RightShift: (left, right)
75Add: (left, right)
76Sub: (left, right)
77Mul: (left, right)
78Div: (left, right)
79Mod: (left, right)
80Power: (left, right)
Jeremy Hylton5477f522001-08-29 18:08:02 +000081FloorDiv: (left, right)
Jeremy Hylton821eee32000-10-25 17:59:17 +000082UnaryAdd: expr
83UnarySub: expr
84Invert: expr
85
86init(Function):
87 self.varargs = self.kwargs = None
88 if flags & CO_VARARGS:
89 self.varargs = 1
90 if flags & CO_VARKEYWORDS:
91 self.kwargs = 1
92
93init(Lambda):
94 self.varargs = self.kwargs = None
95 if flags & CO_VARARGS:
96 self.varargs = 1
97 if flags & CO_VARKEYWORDS:
98 self.kwargs = 1
Neal Norwitzc1505362006-12-28 06:47:50 +000099 self.returns = None
Raymond Hettinger354433a2004-05-19 08:20:33 +0000100
101init(GenExpr):
Neal Norwitzc1505362006-12-28 06:47:50 +0000102 self.arguments = [SimpleArg('.0', None)]
Raymond Hettinger354433a2004-05-19 08:20:33 +0000103 self.varargs = self.kwargs = None
Guido van Rossum4f72a782006-10-27 23:31:49 +0000104 self.kwonlyargs = ()
Raymond Hettinger354433a2004-05-19 08:20:33 +0000105
106init(GenExprFor):
107 self.is_outmost = False