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

Method parse_for

deps/v8/third_party/jinja2/parser.py:234–251  ·  view source on GitHub ↗

Parse a for loop.

(self)

Source from the content-addressed store, hash-verified

232 return nodes.AssignBlock(target, filter_node, body, lineno=lineno)
233
234 def parse_for(self) -> nodes.For:
235 """Parse a for loop."""
236 lineno = self.stream.expect("name:for").lineno
237 target = self.parse_assign_target(extra_end_rules=("name:in",))
238 self.stream.expect("name:in")
239 iter = self.parse_tuple(
240 with_condexpr=False, extra_end_rules=("name:recursive",)
241 )
242 test = None
243 if self.stream.skip_if("name:if"):
244 test = self.parse_expression()
245 recursive = self.stream.skip_if("name:recursive")
246 body = self.parse_statements(("name:endfor", "name:else"))
247 if next(self.stream).value == "endfor":
248 else_ = []
249 else:
250 else_ = self.parse_statements(("name:endfor",), drop_needle=True)
251 return nodes.For(target, iter, body, else_, test, recursive, lineno=lineno)
252
253 def parse_if(self) -> nodes.If:
254 """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