cadenza / org.intelligence.parser

Package org.intelligence.parser

Parsing combinators

Types

Mark

class Mark

Parse

open class Parse

Parser

typealias Parser<T> = Parse.() -> T

Properties

atEof

val Parse.atEof: Boolean

eof

val Parse.eof: Unit

mark

val Parse.mark: Mark

next

val Parse.next: Char

Functions

char

fun Parse.char(c: Char): Char

choice

fun <P : Parse, T> P.choice(vararg alts: P.() -> T): T

expected

fun Parse.expected(what: Any): Nothing

expected2

fun expected2(what: Any): Parser<Nothing>

fail

fun Parse.fail(message: String? = null): Nothing

many

fun <P : Parse, T> P.many(item: P.() -> T): List<T>

manyTill

fun <P : Parse, A> P.manyTill(p: P.() -> A, q: P.() -> Any): List<A>

manyTillPair

fun <P : Parse, A, B> P.manyTillPair(p: P.() -> A, q: P.() -> B): Pair<List<A>, B>

match

fun Parse.match(pattern: Pattern): Matcher

named

fun <P : Parse, T> P.named(what: Any, action: P.() -> T): T

optional

fun <P : Parse, T> P.optional(item: P.() -> T): T?

parse

fun <T> Parse.parse(p: Parser<T>): T

parser

fun <A> parser(p: Parser<A>): Parser<A>

release

fun Parse.release(mark: Mark): Unit

satisfy

fun Parse.satisfy(predicate: (Char) -> Boolean): Char

some

fun <P : Parse, T> P.some(item: P.() -> T): List<T>

spanned

fun <P : Parse, A, R> P.spanned(p: P.() -> A): Pair<A, Loc>

string

fun Parse.string(s: String): String

toList

fun Expected?.toList(): List<Any>

trying

fun <P : Parse, T> P.trying(what: Any, action: P.() -> T): T