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

Method pseudo_def

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

Source from the content-addressed store, hash-verified

594
595 @contextual
596 def pseudo_def(self) -> Pseudo | None:
597 if (tkn := self.expect(lx.IDENTIFIER)) and tkn.text == "pseudo":
598 size = None
599 if self.expect(lx.LPAREN):
600 if tkn := self.expect(lx.IDENTIFIER):
601 if self.expect(lx.COMMA):
602 inp, outp = self.io_effect()
603 if self.expect(lx.COMMA):
604 flags = self.flags()
605 else:
606 flags = []
607 if self.expect(lx.RPAREN):
608 if self.expect(lx.EQUALS):
609 if self.expect(lx.LBRACE):
610 as_sequence = False
611 closing = lx.RBRACE
612 elif self.expect(lx.LBRACKET):
613 as_sequence = True
614 closing = lx.RBRACKET
615 else:
616 raise self.make_syntax_error("Expected { or [")
617 if members := self.members(allow_sequence=True):
618 if self.expect(closing) and self.expect(lx.SEMI):
619 return Pseudo(
620 tkn.text, inp, outp, flags, members, as_sequence
621 )
622 return None
623
624 def members(self, allow_sequence : bool=False) -> list[str] | None:
625 here = self.getpos()

Callers 1

definitionMethod · 0.95

Calls 6

expectMethod · 0.95
io_effectMethod · 0.95
flagsMethod · 0.95
make_syntax_errorMethod · 0.95
membersMethod · 0.95
PseudoClass · 0.85

Tested by

no test coverage detected