Fix double printing

This commit is contained in:
Tibo De Peuter 2025-04-30 10:52:58 +02:00
parent bfb509f41f
commit 1e087c8339
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
3 changed files with 12 additions and 6 deletions

View file

@ -24,19 +24,21 @@ class Repl {
}
fun query(): Answers {
val queryString = io.prompt("?-", { "" })
val queryString = io.prompt("?-", { "| " })
val simpleQuery = parser.parse(queryString)
val query = preprocessor.preprocess(simpleQuery)
Logger.debug("Satisfying query: $query")
return query.satisfy(emptyMap())
}
fun printAnswers(answers: Answers) {
val knownCommands = setOf(";", "a", ".", "h")
if (answers.none()) {
val iterator = answers.iterator()
if (!iterator.hasNext()) {
io.say("false.")
} else {
val iterator = answers.iterator()
var previous = iterator.next()
io.say(prettyPrint(previous))