aboutsummaryrefslogtreecommitdiffstats
path: root/src/resp.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resp.hpp')
-rw-r--r--src/resp.hpp39
1 files changed, 1 insertions, 38 deletions
diff --git a/src/resp.hpp b/src/resp.hpp
index 4be28bd..e551c0c 100644
--- a/src/resp.hpp
+++ b/src/resp.hpp
@@ -521,44 +521,7 @@ struct PEnv : private map<const string, ASymbol*> {
return sym;
}
}
- ATuple* parseTuple(const ATuple* e) {
- ATuple* ret = new ATuple(e->loc);
- FOREACHP(ATuple::const_iterator, i, e)
- ret->push_back(parse(*i));
- return ret;
- }
- AST* parse(const AST* exp) {
- const ATuple* tup = exp->to<const ATuple*>();
- if (tup) {
- if (tup->empty()) throw Error(exp->loc, "call to empty list");
- if (!tup->head()->to<const ATuple*>()) {
- MF mf = mac(*tup->head()->to<const ALexeme*>());
- const AST* expanded = (mf ? mf(*this, exp) : exp);
- const ATuple* expanded_tup = expanded->to<const ATuple*>();
- const PEnv::Handler* h = handler(true, *expanded_tup->head()->to<const ALexeme*>());
- if (h)
- return h->func(*this, expanded, h->arg);
- }
- ATuple* parsed_tup = parseTuple(tup);
- return new ACall(parsed_tup); // Parse as regular call
- }
- const ALexeme* lex = exp->to<const ALexeme*>();
- assert(lex);
- 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);
- else
- return new ALiteral<float>(strtod(s.c_str(), NULL), exp->loc);
- } else if ((*lex)[0] == '\"') {
- return new AString(exp->loc, lex->substr(1, lex->length() - 2));
- } else {
- const PEnv::Handler* h = handler(false, *lex);
- if (h)
- return h->func(*this, exp, h->arg);
- }
- return sym(*lex, exp->loc);
- }
+ AST* parse(const AST* exp);
unsigned symID;
};