| 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]: |