Skip to content

Commit

Permalink
Fix running the evaluator from the CLI.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkasak committed Jan 14, 2025
1 parent 36659f1 commit 88e0ef6
Showing 1 changed file with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ public void _exec(ExecOptions options) throws Exception {
}
}
OutputTrace trace = new OutputTrace(quiet || outdir == null ? null : stderr);
Map<CommandInfo, A4Solution> answers = new TreeMap<>();
int n = 0;

int repeat = options.repeat(1);
Expand Down Expand Up @@ -281,9 +280,8 @@ public void _exec(ExecOptions options) throws Exception {
trace.format(" expects=%s", c.expects);
error("'%s' was satisfied against expectation",c);
}

if (options.evaluator() && !answers.isEmpty()) {
evaluator(world, answers);
if (options.evaluator()) {
evaluator(world, solution);
}
}
n++;
Expand Down Expand Up @@ -358,19 +356,15 @@ private String getStem(File file) {
return parts[0];
}

private void evaluator(CompModule world, Map<CommandInfo, A4Solution> answers) throws Exception {
for (Entry<CommandInfo, A4Solution> s : answers.entrySet()) {
A4Solution sol = s.getValue();
if (sol.satisfiable()) {
stdout.println("Evaluator for " + s.getKey().command);
stdout.flush();
Evaluator e = new Evaluator(world, sol, stdin, stdout);
String lastCommand = e.loop();
if (lastCommand.equals("/exit"))
break;
}
private void evaluator(CompModule world, A4Solution sol) throws Exception {
if (sol.satisfiable()) {
stdout.println("Evaluator for latest command");
stdout.flush();
Evaluator e = new Evaluator(world, sol, stdin, stdout);
String lastCommand = e.loop();
if (lastCommand.equals("/exit"))
return;
}
stdout.println("bye");
}

@Arguments(arg = "path")
Expand Down

0 comments on commit 88e0ef6

Please sign in to comment.