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

Method family_def

Tools/cases_generator/parsing.py:557–577  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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()

Callers 1

definitionMethod · 0.95

Calls 4

expectMethod · 0.95
make_syntax_errorMethod · 0.95
membersMethod · 0.95
FamilyClass · 0.70

Tested by

no test coverage detected