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

Method parse_if

tools/inspector_protocol/jinja2/parser.py:207–225  ·  view source on GitHub ↗

Parse an if construct.

(self)

Source from the content-addressed store, hash-verified

205 recursive, lineno=lineno)
206
207 def parse_if(self):
208 """Parse an if construct."""
209 node = result = nodes.If(lineno=self.stream.expect('name:if').lineno)
210 while 1:
211 node.test = self.parse_tuple(with_condexpr=False)
212 node.body = self.parse_statements(('name:elif', 'name:else',
213 'name:endif'))
214 node.elif_ = []
215 node.else_ = []
216 token = next(self.stream)
217 if token.test('name:elif'):
218 node = nodes.If(lineno=self.stream.current.lineno)
219 result.elif_.append(node)
220 continue
221 elif token.test('name:else'):
222 result.else_ = self.parse_statements(('name:endif',),
223 drop_needle=True)
224 break
225 return result
226
227 def parse_with(self):
228 node = nodes.With(lineno=next(self.stream).lineno)

Callers

nothing calls this directly

Calls 6

parse_tupleMethod · 0.95
parse_statementsMethod · 0.95
nextFunction · 0.50
expectMethod · 0.45
testMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected