Call & Ignore
This commit is contained in:
parent
9b454a9669
commit
5bfeb96176
7 changed files with 118 additions and 28 deletions
|
@ -6,6 +6,7 @@ import io.Terminal
|
|||
import parser.ReplParser
|
||||
import prolog.Answer
|
||||
import prolog.Answers
|
||||
import prolog.flags.AppliedCut
|
||||
|
||||
class Repl {
|
||||
private val io = Terminal()
|
||||
|
@ -101,8 +102,15 @@ class Repl {
|
|||
}
|
||||
return subs.entries.joinToString(",\n") { "${it.key} = ${it.value}" }
|
||||
},
|
||||
onFailure = {
|
||||
return "ERROR: ${it.message}"
|
||||
onFailure = { failure ->
|
||||
if (failure is AppliedCut) {
|
||||
if (failure.subs != null) {
|
||||
return prettyPrint(Result.success(failure.subs))
|
||||
}
|
||||
return "false."
|
||||
}
|
||||
|
||||
return "ERROR: ${failure.message}"
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
Reference in a new issue