1 | # 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)
|
9 | #
|
10 | # If you add node types here, please be sure to update the list of
|
11 | # Node types in Doc/lib/asttable.tex.
|
12 | Module: doc*, node
|
13 | Stmt: nodes!
|
14 | Decorators: nodes!
|
15 | Function: decorators&, name*, argnames*, defaults!, flags*, doc*, code
|
16 | Lambda: argnames*, defaults!, flags*, code
|
17 | Class: name*, bases!, doc*, code, decorators& = None
|
18 | Pass:
|
19 | Break:
|
20 | Continue:
|
21 | For: assign, list, body, else_&
|
22 | While: test, body, else_&
|
23 | With: expr, vars&, body
|
24 | If: tests!, else_&
|
25 | IfExp: test, then, else_
|
26 | Exec: expr, locals&, globals&
|
27 | From: modname*, names*, level*
|
28 | Import: names*
|
29 | Raise: expr1&, expr2&, expr3&
|
30 | TryFinally: body, final
|
31 | TryExcept: body, handlers!, else_&
|
32 | Return: value
|
33 | Yield: value
|
34 | Const: value*
|
35 | Print: nodes!, dest&
|
36 | Printnl: nodes!, dest&
|
37 | Discard: expr
|
38 | AugAssign: node, op*, expr
|
39 | Assign: nodes!, expr
|
40 | AssTuple: nodes!
|
41 | AssList: nodes!
|
42 | AssName: name*, flags*
|
43 | AssAttr: expr, attrname*, flags*
|
44 | ListComp: expr, quals!
|
45 | ListCompFor: assign, list, ifs!
|
46 | ListCompIf: test
|
47 | GenExpr: code
|
48 | GenExprInner: expr, quals!
|
49 | GenExprFor: assign, iter, ifs!
|
50 | GenExprIf: test
|
51 | List: nodes!
|
52 | Dict: items!
|
53 | Not: expr
|
54 | Compare: expr, ops!
|
55 | Name: name*
|
56 | Global: names*
|
57 | Backquote: expr
|
58 | Getattr: expr, attrname*
|
59 | CallFunc: node, args!, star_args& = None, dstar_args& = None
|
60 | Keyword: name*, expr
|
61 | Subscript: expr, flags*, subs!
|
62 | Ellipsis:
|
63 | Sliceobj: nodes!
|
64 | Slice: expr, flags*, lower&, upper&
|
65 | Assert: test, fail&
|
66 | Tuple: nodes!
|
67 | Or: nodes!
|
68 | And: nodes!
|
69 | Bitor: nodes!
|
70 | Bitxor: nodes!
|
71 | Bitand: nodes!
|
72 | LeftShift: (left, right)
|
73 | RightShift: (left, right)
|
74 | Add: (left, right)
|
75 | Sub: (left, right)
|
76 | Mul: (left, right)
|
77 | Div: (left, right)
|
78 | Mod: (left, right)
|
79 | Power: (left, right)
|
80 | FloorDiv: (left, right)
|
81 | UnaryAdd: expr
|
82 | UnarySub: expr
|
83 | Invert: expr
|
84 |
|
85 | # NOTE: Added these for OPy. Upstream Python's ast.txt apparently got out of
|
86 | # sync with ast.py.
|
87 | DictComp: key, value, quals!
|
88 | SetComp: expr, quals!
|
89 | Set: nodes!
|
90 |
|
91 | init(Function):
|
92 | self.varargs = self.kwargs = None
|
93 | if flags & CO_VARARGS:
|
94 | self.varargs = 1
|
95 | if flags & CO_VARKEYWORDS:
|
96 | self.kwargs = 1
|
97 |
|
98 | init(Lambda):
|
99 | self.varargs = self.kwargs = None
|
100 | if flags & CO_VARARGS:
|
101 | self.varargs = 1
|
102 | if flags & CO_VARKEYWORDS:
|
103 | self.kwargs = 1
|
104 |
|
105 | init(GenExpr):
|
106 | self.argnames = ['.0']
|
107 | self.varargs = self.kwargs = None
|
108 |
|
109 | init(GenExprFor):
|
110 | self.is_outmost = False
|