MCPcopy Create free account
hub / github.com/sphinx-doc/sphinx / fetch_token

Method fetch_token

sphinx/pycode/parser.py:156–167  ·  view source on GitHub ↗

Fetch the next token from source code. Returns ``None`` if sequence finished.

(self)

Source from the content-addressed store, hash-verified

154 return self.buffers[lineno - 1]
155
156 def fetch_token(self) -> Token | None:
157 """Fetch the next token from source code.
158
159 Returns ``None`` if sequence finished.
160 """
161 try:
162 self.previous = self.current
163 self.current = Token(*next(self.tokens))
164 except StopIteration:
165 self.current = None
166
167 return self.current
168
169 def fetch_until(self, condition: Any) -> list[Token]:
170 """Fetch tokens until specified token appeared.

Callers 7

fetch_untilMethod · 0.95
fetch_rvalueMethod · 0.80
parseMethod · 0.80
parseMethod · 0.80
parse_definitionMethod · 0.80
fetch_type_param_specMethod · 0.80
parseMethod · 0.80

Calls 1

TokenClass · 0.85

Tested by

no test coverage detected