mirror of
https://github.com/vonhyou/lisp-interpreter.git
synced 2025-06-08 10:21:59 +00:00
format
This commit is contained in:
parent
6e5d36a823
commit
3cb684840a
1 changed files with 4 additions and 5 deletions
|
@ -44,17 +44,16 @@ end
|
|||
|
||||
def atom(token)
|
||||
# Analyse numbers and symbols
|
||||
isInteger = ->(atom) { atom.match?(/^-?\d+$/) }
|
||||
isFloat = ->(atom) { atom.match?(/^(-?\d+)(\.\d+)?$/) }
|
||||
return Integer token if isInteger.call token
|
||||
return Float token if isFloat.call token
|
||||
is_integer = ->(atom) { atom.match?(/^-?\d+$/) }
|
||||
is_float = ->(atom) { atom.match?(/^(-?\d+)(\.\d+)?$/) }
|
||||
return Integer token if is_integer.call token
|
||||
return Float token if is_float.call token
|
||||
|
||||
token.to_sym
|
||||
end
|
||||
|
||||
# p parse '(def 1 2 (c 3.3 (r f r) e))'
|
||||
|
||||
|
||||
##### Environments
|
||||
|
||||
def generate_env
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue