aboutsummaryrefslogtreecommitdiffstats
path: root/src/parse.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse.cpp')
-rw-r--r--src/parse.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/parse.cpp b/src/parse.cpp
index bbf3ca9..78aae69 100644
--- a/src/parse.cpp
+++ b/src/parse.cpp
@@ -68,9 +68,9 @@ PEnv::parse(const AST* exp)
if (isdigit((*lex)[0])) {
const std::string& s = *lex;
if (s.find('.') == string::npos)
- return new ALiteral<int32_t>(strtol(s.c_str(), NULL, 10), exp->loc);
+ return new ALiteral<int32_t>(T_INT32, strtol(s.c_str(), NULL, 10), exp->loc);
else
- return new ALiteral<float>(strtod(s.c_str(), NULL), exp->loc);
+ return new ALiteral<float>(T_FLOAT, strtod(s.c_str(), NULL), exp->loc);
} else if ((*lex)[0] == '\"') {
return new AString(exp->loc, lex->substr(1, lex->length() - 2));
} else {
@@ -134,11 +134,10 @@ parseCall(PEnv& penv, const AST* exp, void* arg)
return parseTuple(penv, exp->to<const ATuple*>());
}
-template<typename T>
inline AST*
-parseLiteral(PEnv& penv, const AST* exp, void* arg)
+parseBool(PEnv& penv, const AST* exp, void* arg)
{
- return new ALiteral<T>(*reinterpret_cast<T*>(arg), exp->loc);
+ return new ALiteral<bool>(T_BOOL, *reinterpret_cast<bool*>(arg), exp->loc);
}
inline AST*
@@ -187,8 +186,8 @@ initLang(PEnv& penv, TEnv& tenv)
// Literals
static bool trueVal = true;
static bool falseVal = false;
- penv.reg(false, "#t", PEnv::Handler(parseLiteral<bool>, &trueVal));
- penv.reg(false, "#f", PEnv::Handler(parseLiteral<bool>, &falseVal));
+ penv.reg(false, "#t", PEnv::Handler(parseBool, &trueVal));
+ penv.reg(false, "#f", PEnv::Handler(parseBool, &falseVal));
// Macros
penv.defmac("def", macDef);