(self)
| 555 | |
| 556 | @contextual |
| 557 | def family_def(self) -> Family | None: |
| 558 | if (tkn := self.expect(lx.IDENTIFIER)) and tkn.text == "family": |
| 559 | size = None |
| 560 | if self.expect(lx.LPAREN): |
| 561 | if tkn := self.expect(lx.IDENTIFIER): |
| 562 | if self.expect(lx.COMMA): |
| 563 | if not (size := self.expect(lx.IDENTIFIER)): |
| 564 | if not (size := self.expect(lx.NUMBER)): |
| 565 | raise self.make_syntax_error( |
| 566 | "Expected identifier or number" |
| 567 | ) |
| 568 | if self.expect(lx.RPAREN): |
| 569 | if self.expect(lx.EQUALS): |
| 570 | if not self.expect(lx.LBRACE): |
| 571 | raise self.make_syntax_error("Expected {") |
| 572 | if members := self.members(): |
| 573 | if self.expect(lx.RBRACE) and self.expect(lx.SEMI): |
| 574 | return Family( |
| 575 | tkn.text, size.text if size else "", members |
| 576 | ) |
| 577 | return None |
| 578 | |
| 579 | def flags(self) -> list[str]: |
| 580 | here = self.getpos() |
no test coverage detected