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

Method parse_statement

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

Parse a single statement.

(self)

Source from the content-addressed store, hash-verified

163 return rv
164
165 def parse_statement(self) -> t.Union[nodes.Node, t.List[nodes.Node]]:
166 """Parse a single statement."""
167 token = self.stream.current
168 if token.type != "name":
169 self.fail("tag name expected", token.lineno)
170 self._tag_stack.append(token.value)
171 pop_tag = True
172 try:
173 if token.value in _statement_keywords:
174 f = getattr(self, f"parse_{self.stream.current.value}")
175 return f() # type: ignore
176 if token.value == "call":
177 return self.parse_call_block()
178 if token.value == "filter":
179 return self.parse_filter_block()
180 ext = self.extensions.get(token.value)
181 if ext is not None:
182 return ext(self)
183
184 # did not work out, remove the token we pushed by accident
185 # from the stack so that the unknown tag fail function can
186 # produce a proper error message.
187 self._tag_stack.pop()
188 pop_tag = False
189 self.fail_unknown_tag(token.value, token.lineno)
190 finally:
191 if pop_tag:
192 self._tag_stack.pop()
193
194 def parse_statements(
195 self, end_tokens: t.Tuple[str, ...], drop_needle: bool = False

Callers 1

subparseMethod · 0.95

Calls 9

failMethod · 0.95
parse_call_blockMethod · 0.95
parse_filter_blockMethod · 0.95
fail_unknown_tagMethod · 0.95
popMethod · 0.80
getMethod · 0.65
fFunction · 0.50
extFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected