aboutsummaryrefslogtreecommitdiffstats
path: root/src/repl.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-10 04:24:20 +0000
committerDavid Robillard <d@drobilla.net>2010-12-10 04:24:20 +0000
commit22e329617866a6580ccff5636f148d72603fa8fc (patch)
tree4038bdc902a7726da493850e71e81b1b01102622 /src/repl.cpp
parent4b2af37d24d864db463d004930f924b5adfebc28 (diff)
downloadresp-22e329617866a6580ccff5636f148d72603fa8fc.tar.gz
resp-22e329617866a6580ccff5636f148d72603fa8fc.tar.bz2
resp-22e329617866a6580ccff5636f148d72603fa8fc.zip
Move simplification from lift stage to a new (post-typing) simplify stage.
git-svn-id: http://svn.drobilla.net/resp/resp@344 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/repl.cpp')
-rw-r--r--src/repl.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/repl.cpp b/src/repl.cpp
index 52d35c5..063f1e7 100644
--- a/src/repl.cpp
+++ b/src/repl.cpp
@@ -100,12 +100,26 @@ eval(CEnv& cenv, Cursor& cursor, istream& is, bool execute)
return 0;
}
+ // Simplify all expressions
+ Code simplified;
+ for (Parsed::const_iterator i = parsed.begin(); i != parsed.end(); ++i) {
+ const AST* l = resp_simplify(cenv, *i);
+ if (l)
+ simplified.push_back(l);
+ }
+
+ if (cenv.args.find("-R") != cenv.args.end()) {
+ for (Code::const_iterator i = simplified.begin(); i != simplified.end(); ++i)
+ pprint(cout, *i, &cenv, (cenv.args.find("-a") != cenv.args.end()));
+ return 0;
+ }
+
CVal val = NULL;
CFunc f = NULL;
// Lift all expressions
Code lifted;
- for (Parsed::const_iterator i = parsed.begin(); i != parsed.end(); ++i) {
+ for (Parsed::const_iterator i = simplified.begin(); i != simplified.end(); ++i) {
const AST* l = resp_lift(cenv, lifted, *i);
if (l)
lifted.push_back(l);
@@ -114,7 +128,6 @@ eval(CEnv& cenv, Cursor& cursor, istream& is, bool execute)
if (cenv.args.find("-L") != cenv.args.end()) {
for (Code::const_iterator i = lifted.begin(); i != lifted.end(); ++i)
pprint(cout, *i, &cenv, (cenv.args.find("-a") != cenv.args.end()));
-
return 0;
}