You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
677 B
31 lines
677 B
#include "linenoise.hpp"
|
|
#include "repl.hpp"
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
int repl(Env& env, bool print_ast)
|
|
{
|
|
for (;;) {
|
|
auto line = linenoise::Readline("cul> ");
|
|
|
|
if (line == "exit" || line == "quit") {
|
|
break;
|
|
}
|
|
|
|
if (!line.empty()) {
|
|
Value val;
|
|
string msg;
|
|
if (run(env, line.c_str(), line.size(), val, msg, print_ast)) {
|
|
cout << val << endl;
|
|
linenoise::AddHistory(line.c_str());
|
|
} else if (!msg.empty()) {
|
|
cout << msg << endl;
|
|
}
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
// vim: et ts=4 sw=4 cin cino={1s ff=unix
|
|
|