MCPcopy
hub / github.com/pallets/jinja / parse_with

Method parse_with

src/jinja2/parser.py:273–288  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

271 return result
272
273 def parse_with(self) -> nodes.With:
274 node = nodes.With(lineno=next(self.stream).lineno)
275 targets: t.List[nodes.Expr] = []
276 values: t.List[nodes.Expr] = []
277 while self.stream.current.type != "block_end":
278 if targets:
279 self.stream.expect("comma")
280 target = self.parse_assign_target()
281 target.set_ctx("param")
282 targets.append(target)
283 self.stream.expect("assign")
284 values.append(self.parse_expression())
285 node.targets = targets
286 node.values = values
287 node.body = self.parse_statements(("name:endwith",), drop_needle=True)
288 return node
289
290 def parse_autoescape(self) -> nodes.Scope:
291 node = nodes.ScopedEvalContextModifier(lineno=next(self.stream).lineno)

Callers

nothing calls this directly

Calls 5

parse_assign_targetMethod · 0.95
parse_expressionMethod · 0.95
parse_statementsMethod · 0.95
expectMethod · 0.80
set_ctxMethod · 0.80

Tested by

no test coverage detected