Numbers become numbers; #t and #f are booleans; "..." string; otherwise Symbol.
(token)
| 78 | quotes = {"'":_quote, "`":_quasiquote, ",":_unquote, ",@":_unquotesplicing} |
| 79 | |
| 80 | def atom(token): |
| 81 | 'Numbers become numbers; #t and #f are booleans; "..." string; otherwise Symbol.' |
| 82 | if token == '#t': return True |
| 83 | elif token == '#f': return False |
| 84 | elif token[0] == '"': return token[1:-1] |
| 85 | try: return int(token) |
| 86 | except ValueError: |
| 87 | try: return float(token) |
| 88 | except ValueError: |
| 89 | try: return complex(token.replace('i', 'j', 1)) |
| 90 | except ValueError: |
| 91 | return Sym(token) |
| 92 | |
| 93 | def to_string(x): |
| 94 | "Convert a Python object back into a Lisp-readable string." |
no test coverage detected