diff options
| author | Joel Martin <github@martintribe.org> | 2014-11-03 20:32:46 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-01-09 16:16:44 -0600 |
| commit | 8128c69a1da03d3b8d62defb4533c3e3ae706682 (patch) | |
| tree | c005e9b22c1a851dbea727a127173011b94ec04a /r/reader.r | |
| parent | c30efef469e22c8ba345a72c058c28362e57b746 (diff) | |
| download | mal-8128c69a1da03d3b8d62defb4533c3e3ae706682.tar.gz mal-8128c69a1da03d3b8d62defb4533c3e3ae706682.zip | |
R: add step8_macros and step9_try.
Diffstat (limited to 'r/reader.r')
| -rw-r--r-- | r/reader.r | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -38,8 +38,10 @@ re_match <- function(re, str) { length(grep(re, c(str))) > 0 } read_atom <- function(rdr) { token <- Reader.next(rdr) - if (re_match("^-?[0-9][0-9.]*$", token)) { - as.numeric(token) + if (re_match("^-?[0-9]+$", token)) { + as.integer(token) + } else if (re_match("^-?[0-9][0-9.]*$", token)) { + as.double(token) } else if (substr(token,1,1) == "\"") { gsub("\\\\n", "\\n", gsub("\\\\\"", "\"", |
