MCPcopy Index your code
hub / github.com/python/cpython / dump

Method dump

Lib/re/_parser.py:120–161  ·  view source on GitHub ↗
(self, level=0)

Source from the content-addressed store, hash-verified

118 self.width = None
119
120 def dump(self, level=0):
121 seqtypes = (tuple, list)
122 for op, av in self.data:
123 print(level*" " + str(op), end='')
124 if op is IN:
125 # member sublanguage
126 print()
127 for op, a in av:
128 print((level+1)*" " + str(op), a)
129 elif op is BRANCH:
130 print()
131 for i, a in enumerate(av[1]):
132 if i:
133 print(level*" " + "OR")
134 a.dump(level+1)
135 elif op is GROUPREF_EXISTS:
136 condgroup, item_yes, item_no = av
137 print('', condgroup)
138 item_yes.dump(level+1)
139 if item_no:
140 print(level*" " + "ELSE")
141 item_no.dump(level+1)
142 elif isinstance(av, SubPattern):
143 print()
144 av.dump(level+1)
145 elif isinstance(av, seqtypes):
146 nl = False
147 for a in av:
148 if isinstance(a, SubPattern):
149 if not nl:
150 print()
151 a.dump(level+1)
152 nl = True
153 else:
154 if not nl:
155 print(' ', end='')
156 print(a, end='')
157 nl = False
158 if not nl:
159 print()
160 else:
161 print('', av)
162 def __repr__(self):
163 return repr(self.data)
164 def __len__(self):

Callers 1

parseFunction · 0.45

Calls 2

strFunction · 0.85
enumerateFunction · 0.85

Tested by

no test coverage detected