aboutsummaryrefslogtreecommitdiff
path: root/parser.cpp
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2013-08-05 23:31:48 +0800
committerTeddy <ted.sybil@gmail.com>2013-08-05 23:31:48 +0800
commit2ec8f26f31d13bf3c3bbda24ea5e1cace6a819a2 (patch)
treef623aaa220efa2993161997729dce9ff03d936ad /parser.cpp
parent5dab7df6830018c5c28ebcc7cc3b242ccad2736b (diff)
added support for string
Diffstat (limited to 'parser.cpp')
-rw-r--r--parser.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/parser.cpp b/parser.cpp
index cb8695f..07ca066 100644
--- a/parser.cpp
+++ b/parser.cpp
@@ -105,14 +105,11 @@ ASTGenerator::ASTGenerator() {}
EvalObj *ASTGenerator::to_obj(const string &str) {
EvalObj *res = NULL;
- if ((res = IntNumObj::from_string(str)))
- return res;
- if ((res = RatNumObj::from_string(str)))
- return res;
- if ((res = RealNumObj::from_string(str)))
- return res;
- if ((res = CompNumObj::from_string(str)))
- return res;
+ if ((res = IntNumObj::from_string(str))) return res;
+ if ((res = RatNumObj::from_string(str))) return res;
+ if ((res = RealNumObj::from_string(str))) return res;
+ if ((res = CompNumObj::from_string(str))) return res;
+ if ((res = StrObj::from_string(str))) return res;
return new SymObj(str);
}
Cons *ASTGenerator::absorb(Tokenizor *tk) {