MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / next_token

Method next_token

18-with-match/lispy/original/lispy.py:44–51  ·  view source on GitHub ↗

Return the next token, reading new text into line buffer if needed.

(self)

Source from the content-addressed store, hash-verified

42 def __init__(self, file):
43 self.file = file; self.line = ''
44 def next_token(self):
45 "Return the next token, reading new text into line buffer if needed."
46 while True:
47 if self.line == '': self.line = self.file.readline()
48 if self.line == '': return eof_object
49 token, self.line = re.match(InPort.tokenizer, self.line).groups()
50 if token != '' and not token.startswith(';'):
51 return token
52
53def readchar(inport):
54 "Read the next character from an input port."

Callers 2

read_aheadFunction · 0.80
readFunction · 0.80

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected