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

Method alts

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

Source from the content-addressed store, hash-verified

246
247 @memoize
248 def alts(self) -> Optional[Rhs]:
249 # alts: alt "|" alts | alt
250 mark = self._mark()
251 if (
252 (alt := self.alt())
253 and
254 (literal := self.expect("|"))
255 and
256 (alts := self.alts())
257 ):
258 return Rhs ( [alt] + alts . alts )
259 self._reset(mark)
260 if (
261 (alt := self.alt())
262 ):
263 return Rhs ( [alt] )
264 self._reset(mark)
265 return None
266
267 @memoize
268 def more_alts(self) -> Optional[Rhs]:

Callers 4

ruleMethod · 0.95
more_altsMethod · 0.95
itemMethod · 0.95
atomMethod · 0.95

Calls 4

altMethod · 0.95
RhsClass · 0.90
expectMethod · 0.45
_resetMethod · 0.45

Tested by

no test coverage detected