mirror of
https://github.com/open-goal/jak-project.git
synced 2024-11-27 08:20:47 +00:00
parent
8cc63ff35c
commit
44fa183922
@ -6,7 +6,7 @@ tasks:
|
||||
- python ./third-party/run-clang-format/run-clang-format.py -r common decompiler game goalc test -i
|
||||
run-game:
|
||||
cmds:
|
||||
- ./out/build/Debug/bin/gk.exe -fakeiso -debug
|
||||
- ./out/build/Debug/bin/gk.exe -fakeiso -debug -nodisplay
|
||||
repl:
|
||||
cmds:
|
||||
- ./out/build/Debug/bin/goalc.exe
|
||||
- ./out/build/Debug/bin/goalc.exe -auto-lt
|
@ -31,7 +31,7 @@ Compiler::Compiler(std::unique_ptr<ReplWrapper> repl)
|
||||
}
|
||||
}
|
||||
|
||||
ReplStatus Compiler::execute_repl() {
|
||||
ReplStatus Compiler::execute_repl(bool auto_listen) {
|
||||
// init repl
|
||||
m_repl->print_welcome_message();
|
||||
auto examples = m_repl->examples;
|
||||
@ -45,6 +45,10 @@ ReplStatus Compiler::execute_repl() {
|
||||
m_repl->get_repl().set_highlighter_callback(
|
||||
std::bind(&Compiler::repl_coloring, this, _1, _2, std::cref(regex_colors)));
|
||||
|
||||
if (auto_listen) {
|
||||
m_listener.connect_to_target();
|
||||
}
|
||||
|
||||
while (!m_want_exit && !m_want_reload) {
|
||||
try {
|
||||
// 1). get a line from the user (READ)
|
||||
|
@ -23,7 +23,7 @@ enum class ReplStatus { OK, WANT_EXIT, WANT_RELOAD };
|
||||
class Compiler {
|
||||
public:
|
||||
Compiler(std::unique_ptr<ReplWrapper> repl = nullptr);
|
||||
ReplStatus execute_repl();
|
||||
ReplStatus execute_repl(bool auto_listen = false);
|
||||
goos::Interpreter& get_goos() { return m_goos; }
|
||||
FileEnv* compile_object_file(const std::string& name, goos::Object code, bool allow_emit);
|
||||
std::unique_ptr<FunctionEnv> compile_top_level_function(const std::string& name,
|
||||
|
@ -29,15 +29,17 @@ int main(int argc, char** argv) {
|
||||
|
||||
std::string argument;
|
||||
bool verbose = false;
|
||||
bool auto_listen = false;
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (std::string("-v") == argv[i]) {
|
||||
verbose = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (std::string("-cmd") == argv[i] && i < argc - 1) {
|
||||
argument = argv[++i];
|
||||
}
|
||||
if (std::string("-auto-lt") == argv[i]) {
|
||||
auto_listen = true;
|
||||
}
|
||||
}
|
||||
setup_logging(verbose);
|
||||
|
||||
@ -50,7 +52,7 @@ int main(int argc, char** argv) {
|
||||
ReplStatus status = ReplStatus::WANT_RELOAD;
|
||||
while (status == ReplStatus::WANT_RELOAD) {
|
||||
compiler = std::make_unique<Compiler>(std::make_unique<ReplWrapper>());
|
||||
status = compiler->execute_repl();
|
||||
status = compiler->execute_repl(auto_listen);
|
||||
if (status == ReplStatus::WANT_RELOAD) {
|
||||
fmt::print("Reloading compiler...\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user