MCPcopy Index your code
hub / github.com/pyload/pyload / parse_statement

Method parse_statement

module/lib/jinja2/parser.py:113–139  ·  view source on GitHub ↗

Parse a single statement.

(self)

Source from the content-addressed store, hash-verified

111 return rv
112
113 def parse_statement(self):
114 """Parse a single statement."""
115 token = self.stream.current
116 if token.type != 'name':
117 self.fail('tag name expected', token.lineno)
118 self._tag_stack.append(token.value)
119 pop_tag = True
120 try:
121 if token.value in _statement_keywords:
122 return getattr(self, 'parse_' + self.stream.current.value)()
123 if token.value == 'call':
124 return self.parse_call_block()
125 if token.value == 'filter':
126 return self.parse_filter_block()
127 ext = self.extensions.get(token.value)
128 if ext is not None:
129 return ext(self)
130
131 # did not work out, remove the token we pushed by accident
132 # from the stack so that the unknown tag fail function can
133 # produce a proper error message.
134 self._tag_stack.pop()
135 pop_tag = False
136 self.fail_unknown_tag(token.value, token.lineno)
137 finally:
138 if pop_tag:
139 self._tag_stack.pop()
140
141 def parse_statements(self, end_tokens, drop_needle=False):
142 """Parse multiple statements into a list until one of the end tokens

Callers 1

subparseMethod · 0.95

Calls 7

failMethod · 0.95
parse_call_blockMethod · 0.95
parse_filter_blockMethod · 0.95
fail_unknown_tagMethod · 0.95
popMethod · 0.80
appendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected