Package-level declarations

Types

Link copied to clipboard
abstract class AbstractTuPrologCommand(help: String = "", epilog: String = "", name: String? = null, val invokeWithoutSubcommand: Boolean = false, val printHelpOnEmptyArgs: Boolean = false, val helpTags: Map<String, String> = emptyMap(), val autoCompleteEnvvar: String? = "", val allowMultipleSubcommands: Boolean = false, val treatUnknownOptionsAsArgs: Boolean = false, val hiddenFromHelp: Boolean = false) : CliktCommand

Base class for the clikt commands that make up the 2P-Kt REPL CLI (TuPrologCmd and its solve subcommand TuPrologSolveQuery): it factors out everything both commands need to interact with a user at a terminal -- reading (possibly multi-line, dot-terminated) Prolog queries, and printing the it.unibo.tuprolog.solve.Solutions a it.unibo.tuprolog.solve.Solver produces for them -- so that subclasses only have to configure clikt options/arguments and implement run.

Link copied to clipboard

Signals that the REPL's standard input stream ended (returned null) while a query or a continuation line was expected, e.g. because the terminal was closed or stdin reached end-of-file.

Link copied to clipboard
class TuPrologCmd(additionalLibraries: Library) : AbstractTuPrologCommand

Root clikt command of the 2P-Kt REPL: java -jar 2p-repl.jar.

Link copied to clipboard

The solve subcommand of TuPrologCmd: java -jar 2p-repl.jar solve QUERY [-n N].

Functions

Link copied to clipboard
expect fun isReadableFile(path: String): Boolean

Tells whether path denotes a file that exists and can be read on the current platform.

actual fun isReadableFile(path: String): Boolean

JS implementation: not yet provided.

actual fun isReadableFile(path: String): Boolean

JVM implementation: true iff path is a regular, existing, readable File.

Link copied to clipboard
expect fun loadTheoryFromFile(path: String): Theory

Reads the file at path and parses its content as a Prolog Theory, using the default operator set and :parser-theory's clause parser (see it.unibo.tuprolog.theory.parsing.ClausesParser).

actual fun loadTheoryFromFile(path: String): Theory

JS implementation: not yet provided.

actual fun loadTheoryFromFile(path: String): Theory

JVM implementation: reads path's full content with File.readText and parses it via :parser-theory's Theory.parse extension.

Link copied to clipboard
fun main(args: Array<String>)

JS entry point of the 2P-Kt REPL CLI: builds TuPrologCmd with its solve subcommand (TuPrologSolveQuery) and hands args to clikt for parsing and execution -- mirroring the JVM entry point in Main.kt.

fun main(args: Array<String>)

JVM entry point of the 2P-Kt REPL CLI: builds TuPrologCmd with its solve subcommand (TuPrologSolveQuery) and hands args to clikt for parsing and execution.