MCPcopy
hub / github.com/fluentpython/example-code-2e / tokenize

Function tokenize

18-with-match/lispy/py3.9/lis.py:29–31  ·  view source on GitHub ↗

Convert a string into a list of tokens.

(s: str)

Source from the content-addressed store, hash-verified

27 return read_from_tokens(tokenize(program))
28
29def tokenize(s: str) -> list[str]:
30 "Convert a string into a list of tokens."
31 return s.replace('(', ' ( ').replace(')', ' ) ').split()
32
33def read_from_tokens(tokens: list[str]) -> Expression:
34 "Read an expression from a sequence of tokens."

Callers 2

parseFunction · 0.70
runFunction · 0.70

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected