OILS / opy / tools / ast.txt View on Github | oilshell.org

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