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

Method expect

Tools/cases_generator/plexer.py:54–61  ·  view source on GitHub ↗
(self, kind: str)

Source from the content-addressed store, hash-verified

52 return None
53
54 def expect(self, kind: str) -> Token | None:
55 # Return next token and advance position if kind matches
56 tkn = self.next()
57 if tkn is not None:
58 if tkn.kind == kind:
59 return tkn
60 self.backup()
61 return None
62
63 def require(self, kind: str) -> Token:
64 # Return next token and advance position, requiring kind to match

Callers

nothing calls this directly

Calls 2

nextMethod · 0.95
backupMethod · 0.95

Tested by

no test coverage detected