Package-level declarations

Types

Link copied to clipboard
data class LexerOptions(val retention: TokenRetention = TokenRetention.KEEP_ALL, val maximumRetainedTokens: Int? = null)

Configures lazy token production and retention.

Link copied to clipboard

Selects how the parser resolves an occurrence with several applicable operator definitions.

Link copied to clipboard
data class ParserOptions(val maximumNestingDepth: Int = DEFAULT_MAX_NESTING_DEPTH, val ambiguityPolicy: OperatorAmbiguityPolicy = OperatorAmbiguityPolicy.REJECT)

Configures syntax parsing safeguards and compatibility behavior.

Link copied to clipboard
interface PrologLexer

Produces a lossless, lazy Prolog token stream independently of operator declarations.

Link copied to clipboard
interface PrologParser

Parses a LexedSource into an immutable, lossless concrete syntax tree.

Link copied to clipboard

Stateful, incremental parsing over one input.

Link copied to clipboard
fun interface Representable

An element that can produce a normalized textual representation of itself.

Link copied to clipboard

Stateful clause-by-clause parsing whose input chunks are obtained asynchronously.

Link copied to clipboard

An asynchronous, pull-based producer of text chunks.

Link copied to clipboard
fun interface TextChunkSource

A synchronous, pull-based producer of text chunks.

Link copied to clipboard

Controls how a lazy it.unibo.tuprolog.parser.sources.LexedSource retains consumed input.

Properties

Link copied to clipboard

Default number of UTF-16 code units requested from a JVM Reader at once.

Functions

Link copied to clipboard
fun <T> buildParserFor(source: TextChunkSource, lexerOptions: LexerOptions = LexerOptions(), parserOptions: ParserOptions = ParserOptions(), continuation: (PrologParser, LexedSource) -> T): T

Creates the default lexer and parser for a synchronous chunk source.

fun <T> buildParserFor(source: SourceText, lexerOptions: LexerOptions = LexerOptions(), parserOptions: ParserOptions = ParserOptions(), continuation: (PrologParser, LexedSource) -> T): T

Creates the default lexer and parser for source, then invokes continuation with both.

fun <T> buildParserFor(input: String, id: String? = null, lexerOptions: LexerOptions = LexerOptions(), parserOptions: ParserOptions = ParserOptions(), continuation: (PrologParser, LexedSource) -> T): T

Creates the default lexer and parser for input, identified diagnostically by id.

fun <T> buildParserFor(input: Reader, chunkSize: Int = DEFAULT_READER_CHUNK_SIZE, autoClose: Boolean = true, lexerOptions: LexerOptions = LexerOptions(), parserOptions: ParserOptions = ParserOptions(), continuation: (PrologParser, LexedSource) -> T): T

Creates a lazy lexer and parser over input, then invokes continuation.

Link copied to clipboard
fun PrologParser.openFileSession(file: Any, initialOperators: OperatorTable = OperatorTables.empty(), sourceId: String? = file.asDynamic().name as? String, maximumRetainedTokens: Int? = null): SuspendingPrologParseSession

Opens a UTF-8 suspending parse session over a browser File or Blob.

Link copied to clipboard
fun PrologParser.openReadableStreamSession(stream: Any, initialOperators: OperatorTable = OperatorTables.empty(), sourceId: String? = null, maximumRetainedTokens: Int? = null): SuspendingPrologParseSession

Opens a UTF-8 suspending parse session over a JavaScript ReadableStream<Uint8Array>.

Link copied to clipboard
fun Reader.toSource(chunkSize: Int = DEFAULT_READER_CHUNK_SIZE, autoClose: Boolean = true): TextChunkSource

Adapts this reader to a pull-based TextChunkSource.