diff options
author | David Robillard <d@drobilla.net> | 2009-03-12 05:59:32 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-03-12 05:59:32 +0000 |
commit | 22b5ef111e00af6c1b3c56283b71337d2fda351b (patch) | |
tree | 944981e315eed7aa65d451b5e1b55a9035f655fb /tuplr.cpp | |
parent | ad582fa2ba18ca4391c3d6c084d902d3b1fd5ca5 (diff) | |
download | resp-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.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -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 * ***************************************************************************/ |