From 22b5ef111e00af6c1b3c56283b71337d2fda351b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 12 Mar 2009 05:59:32 +0000 Subject: Tidy. git-svn-id: http://svn.drobilla.net/resp/tuplr@85 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- tuplr.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tuplr.cpp') diff --git a/tuplr.cpp b/tuplr.cpp index 2cf2e63..bfd6192 100644 --- a/tuplr.cpp +++ b/tuplr.cpp @@ -102,6 +102,34 @@ readExpression(Cursor& cur, istream& in) } +/*************************************************************************** + * Parser Functions * + ***************************************************************************/ + +template +inline AST* +parseCall(PEnv& penv, const SExp& exp, void* arg) +{ + return new C(exp, penv.parseTuple(exp)); +} + +template +inline AST* +parseLiteral(PEnv& penv, const SExp& exp, void* arg) +{ + return new ALiteral(*reinterpret_cast(arg), exp.loc); +} + +inline AST* +parseFn(PEnv& penv, const SExp& exp, void* arg) +{ + SExp::List::const_iterator a = exp.list.begin(); ++a; + return new AClosure(exp.loc, penv.sym("fn"), + new ATuple(penv.parseTuple(*a++)), + penv.parse(*a++)); +} + + /*************************************************************************** * Standard Definitions * ***************************************************************************/ -- cgit v1.2.1