MCPcopy Index your code
hub / github.com/python/cpython / more_alts

Method more_alts

Tools/peg_generator/pegen/grammar_parser.py:268–291  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

266
267 @memoize
268 def more_alts(self) -> Optional[Rhs]:
269 # more_alts: "|" alts NEWLINE more_alts | "|" alts NEWLINE
270 mark = self._mark()
271 if (
272 (literal := self.expect("|"))
273 and
274 (alts := self.alts())
275 and
276 (_newline := self.expect('NEWLINE'))
277 and
278 (more_alts := self.more_alts())
279 ):
280 return Rhs ( alts . alts + more_alts . alts )
281 self._reset(mark)
282 if (
283 (literal := self.expect("|"))
284 and
285 (alts := self.alts())
286 and
287 (_newline := self.expect('NEWLINE'))
288 ):
289 return Rhs ( alts . alts )
290 self._reset(mark)
291 return None
292
293 @memoize
294 def alt(self) -> Optional[Alt]:

Callers 1

ruleMethod · 0.95

Calls 4

altsMethod · 0.95
RhsClass · 0.90
expectMethod · 0.45
_resetMethod · 0.45

Tested by

no test coverage detected