aboutsummaryrefslogtreecommitdiffstats
path: root/tuplr.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-03-12 05:59:32 +0000
committerDavid Robillard <d@drobilla.net>2009-03-12 05:59:32 +0000
commit22b5ef111e00af6c1b3c56283b71337d2fda351b (patch)
tree944981e315eed7aa65d451b5e1b55a9035f655fb /tuplr.cpp
parentad582fa2ba18ca4391c3d6c084d902d3b1fd5ca5 (diff)
downloadresp-22b5ef111e00af6c1b3c56283b71337d2fda351b.tar.gz
resp-22b5ef111e00af6c1b3c56283b71337d2fda351b.tar.bz2
resp-22b5ef111e00af6c1b3c56283b71337d2fda351b.zip
Tidy.
git-svn-id: http://svn.drobilla.net/resp/tuplr@85 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'tuplr.cpp')
-rw-r--r--tuplr.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tuplr.cpp b/tuplr.cpp
index 2cf2e63..bfd6192 100644
--- a/tuplr.cpp
+++ b/tuplr.cpp
@@ -103,6 +103,34 @@ readExpression(Cursor& cur, istream& in)
/***************************************************************************
+ * Parser Functions *
+ ***************************************************************************/
+
+template<typename C>
+inline AST*
+parseCall(PEnv& penv, const SExp& exp, void* arg)
+{
+ return new C(exp, penv.parseTuple(exp));
+}
+
+template<typename T>
+inline AST*
+parseLiteral(PEnv& penv, const SExp& exp, void* arg)
+{
+ return new ALiteral<T>(*reinterpret_cast<T*>(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 *
***************************************************************************/