MCPcopy Index your code
hub / github.com/nodejs/node / parse_for

Method parse_for

tools/inspector_protocol/jinja2/parser.py:188–205  ·  view source on GitHub ↗

Parse a for loop.

(self)

Source from the content-addressed store, hash-verified

186 return nodes.AssignBlock(target, filter_node, body, lineno=lineno)
187
188 def parse_for(self):
189 """Parse a for loop."""
190 lineno = self.stream.expect('name:for').lineno
191 target = self.parse_assign_target(extra_end_rules=('name:in',))
192 self.stream.expect('name:in')
193 iter = self.parse_tuple(with_condexpr=False,
194 extra_end_rules=('name:recursive',))
195 test = None
196 if self.stream.skip_if('name:if'):
197 test = self.parse_expression()
198 recursive = self.stream.skip_if('name:recursive')
199 body = self.parse_statements(('name:endfor', 'name:else'))
200 if next(self.stream).value == 'endfor':
201 else_ = []
202 else:
203 else_ = self.parse_statements(('name:endfor',), drop_needle=True)
204 return nodes.For(target, iter, body, else_, test,
205 recursive, lineno=lineno)
206
207 def parse_if(self):
208 """Parse an if construct."""

Callers

nothing calls this directly

Calls 7

parse_assign_targetMethod · 0.95
parse_tupleMethod · 0.95
parse_expressionMethod · 0.95
parse_statementsMethod · 0.95
nextFunction · 0.50
expectMethod · 0.45
skip_ifMethod · 0.45

Tested by

no test coverage detected