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

Method parse_block

tools/inspector_protocol/jinja2/parser.py:255–270  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

253 return nodes.Scope([node])
254
255 def parse_block(self):
256 node = nodes.Block(lineno=next(self.stream).lineno)
257 node.name = self.stream.expect('name').value
258 node.scoped = self.stream.skip_if('name:scoped')
259
260 # common problem people encounter when switching from django
261 # to jinja. we do not support hyphens in block names, so let's
262 # raise a nicer error message in that case.
263 if self.stream.current.type == 'sub':
264 self.fail('Block names in Jinja have to be valid Python '
265 'identifiers and may not contain hyphens, use an '
266 'underscore instead.')
267
268 node.body = self.parse_statements(('name:endblock',), drop_needle=True)
269 self.stream.skip_if('name:' + node.name)
270 return node
271
272 def parse_extends(self):
273 node = nodes.Extends(lineno=next(self.stream).lineno)

Callers

nothing calls this directly

Calls 5

failMethod · 0.95
parse_statementsMethod · 0.95
nextFunction · 0.50
expectMethod · 0.45
skip_ifMethod · 0.45

Tested by

no test coverage detected