aboutsummaryrefslogtreecommitdiff
path: root/r/reader.r
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-11-03 20:32:46 -0600
committerJoel Martin <github@martintribe.org>2015-01-09 16:16:44 -0600
commit8128c69a1da03d3b8d62defb4533c3e3ae706682 (patch)
treec005e9b22c1a851dbea727a127173011b94ec04a /r/reader.r
parentc30efef469e22c8ba345a72c058c28362e57b746 (diff)
downloadmal-8128c69a1da03d3b8d62defb4533c3e3ae706682.tar.gz
mal-8128c69a1da03d3b8d62defb4533c3e3ae706682.zip
R: add step8_macros and step9_try.
Diffstat (limited to 'r/reader.r')
-rw-r--r--r/reader.r6
1 files changed, 4 insertions, 2 deletions
diff --git a/r/reader.r b/r/reader.r
index 8d91f1c..26c80c9 100644
--- a/r/reader.r
+++ b/r/reader.r
@@ -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("\\\\\"", "\"",