| 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 | init(Function):
|
|---|
| 86 | self.varargs = self.kwargs = None
|
|---|
| 87 | if flags & CO_VARARGS:
|
|---|
| 88 | self.varargs = 1
|
|---|
| 89 | if flags & CO_VARKEYWORDS:
|
|---|
| 90 | self.kwargs = 1
|
|---|
| 91 |
|
|---|
| 92 | init(Lambda):
|
|---|
| 93 | self.varargs = self.kwargs = None
|
|---|
| 94 | if flags & CO_VARARGS:
|
|---|
| 95 | self.varargs = 1
|
|---|
| 96 | if flags & CO_VARKEYWORDS:
|
|---|
| 97 | self.kwargs = 1
|
|---|
| 98 |
|
|---|
| 99 | init(GenExpr):
|
|---|
| 100 | self.argnames = ['.0']
|
|---|
| 101 | self.varargs = self.kwargs = None
|
|---|
| 102 |
|
|---|
| 103 | init(GenExprFor):
|
|---|
| 104 | self.is_outmost = False
|
|---|