aboutsummaryrefslogtreecommitdiffstats
path: root/src/repl.cpp
diff options
context:
space:
mode:
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;
}