Skip to content

OptionalScope1

Dokka 2.2.0 generates this reference of the Kotlin spec builder during each site build from the Kotlin sources, and its summary lists every class and function. The guide shows the builder in use, the Java builder's reference covers the handles, types and expressions it shares, and the extensions read the data.

A block at depth 1 whose statements may not run.

Properties

Functions

fun capture(type: FloatType, name: String? = null): Capture<FloatField<DoubleArray?>>

A capture of a float, as the integer one.

fun capture(type: IntType, name: String? = null): Capture<IntField<LongArray?>>

A capture of an integer, for a line pattern: val n by capture(atLeast(1)) names the entry after the property, or after name if given. The handle in a pattern prints {n:1..}.

fun capture(type: NumType, name: String? = null): Capture<NumField<List<Number>?>>

A capture of an integer or float, as the integer one.

fun capture(type: StringType, name: String? = null): Capture<StringField<List<String>?>>

A capture of a string, as the integer one.

fun check(condition: Expr)

check condition.

fun check(condition: Expr, message: String)

check condition "message".

type name = type, a named float type.

fun defineType(name: String, type: IntType): IntType

type name = type, a named integer type.

fun defineType(name: String, type: NumType): NumType

type name = type, a named number type.

type name = type, a named string type.

fun <T> elseIf(condition: Expr, body: OptionalScope1.() -> T): T

else if condition { ... }, right after ifThen or another elseIf.

fun elseReadIf(target: Field<*>, type: Type<*>): DynField

else if:type, the declaration of the name if as the else branch, as Iris.elseReadIf.

fun expect(word: String, vararg more: String)

expect "word" ....

fun find(vararg parts: Any)

find "pattern", with the parts that line takes.

Declares an entry of any type and depth that a later statement defines.

Declares a float entry at depth 0 that a later statement defines.

Declares an integer entry at depth 0 that a later statement defines, as Iris.forward.

Declares an integer or float entry at depth 0 that a later statement defines.

Declares a string entry at depth 0 that a later statement defines; forwardString("_") is the entry that store _ keeps.

fun <T> ifThen(condition: Expr, body: OptionalScope1.() -> T): T

if condition { ... }, whose definitions may be absent.

fun index(position: Expr)
fun index(position: Long)

index position.

fun let(target: Field<*>, value: Expr): DynField

let x = value through a handle, as Iris.let.

fun let(target: Discard, value: Expr)

let _ = value, which evaluates value without storing it.

fun let(name: String, value: DynExpr): DynField

let name = value, whose type and depth the data decide.

fun let(name: String, value: FloatExpr): FloatField<DoubleArray?>

let name = value, a computed float at this block's depth.

fun let(name: String, value: IntExpr): IntField<LongArray?>

let name = value, a computed integer at this block's depth.

fun let(name: String, value: NumExpr): NumField<List<Number>?>

let name = value, a computed integer or float at this block's depth.

fun let(name: String, value: StringExpr): StringField<List<String>?>

let name = value, a computed string at this block's depth.

fun line(vararg parts: Any)

line "pattern": text, handles from capture delegates, and the parts of ref, capture, validate, blank, discard and restOfLine.

fun list(target: Field<*>, reading: ListReading): DynField

x: type until end, a list, as Iris.list.

fun list(target: Discard, reading: ListReading)

_: type until end, which reads a list and keeps nothing.

A capture of a float that may be absent.

fun optionalCapture(type: IntType, name: String? = null): Capture<IntField<LongArray?>>

A capture of an integer that may be absent, such as one in an optional arm.

fun optionalCapture(type: NumType, name: String? = null): Capture<NumField<List<Number>?>>

A capture of an integer or float that may be absent.

A capture of a string that may be absent.

fun <T> otherwise(body: OptionalScope1.() -> T): T

else { ... }, right after ifThen or elseIf.

fun param(target: Field<*>): DynField

param p through a handle, as Iris.param.

fun param(name: String): DynField

param name, whose value and type the caller decides.

fun param(target: Field<*>, default: Expr): DynField

param p = default through a handle, as Iris.param.

fun param(name: String, default: FloatExpr): FloatField<DoubleArray?>

param name = default, a float.

fun param(name: String, default: IntExpr): IntField<LongArray?>

param name = default, an integer.

fun param(name: String, default: NumExpr): NumField<List<Number>?>

param name = default, an integer or float.

fun param(name: String, default: StringExpr): StringField<List<String>?>

param name = default, a string.

fun read(target: Field<*>, type: Type<*>): DynField

x: type through a handle, for a type with dimensions or a name defined elsewhere, as Iris.read.

fun read(target: Discard, type: Type<*>)

_: type, which reads a value and keeps nothing.

name: type, a float at this block's depth.

fun read(name: String, type: IntType): IntField<LongArray?>

name: type, an integer at this block's depth.

fun read(name: String, type: NumType): NumField<List<Number>?>

name: type, an integer or float at this block's depth.

name: type, a string at this block's depth.

fun <T> repeat(count: Expr, record: RecordName = Iris.recordName(), body: OptionalScope2.() -> T): T

repeat count { ... }. The body's receiver is one level deeper, and its record is record, which names the records for projection and comprehensions.

fun <T> repeat(count: Long, record: RecordName = Iris.recordName(), body: OptionalScope2.() -> T): T

repeat count { ... }, as the other repeat.

fun <T> repeatUntil(until: Until, record: RecordName = Iris.recordName(), body: OptionalScope2.() -> T): T

repeat until "end" ... { ... }, with an optional store, as until makes it.

fun <T> repeatUntilEof(record: RecordName = Iris.recordName(), body: OptionalScope2.() -> T): T

repeat until eof { ... }.

fun <T> sections(vararg clauses: SectionClause, body: Sections<OptionalScope1, OptionalScope1>.() -> T): T

sections ... { ... }, with until and skipOther clauses in the order given. The body gives the arms.

fun <T> sections(vararg until: Until, skipOther: Boolean, body: Sections<OptionalScope1, OptionalScope1>.() -> T): T

sections until ... skip other { ... }, with the clauses as arguments.

fun set(handle: DynField, value: Expr)

let x = value through a dynamic handle.

fun set(handle: FloatField<*>, value: FloatExpr)
fun set(handle: FloatField<*>, value: Double)
fun set(handle: IntField<*>, value: Long)
fun set(handle: NumField<*>, value: NumExpr)
fun set(handle: StringField<*>, value: StringExpr)
fun set(handle: StringField<*>, value: String)

let x = value through a handle, keeping its type and depth.

fun set(handle: IntField<*>, value: IntExpr)

let x = value through a handle, keeping its type and depth, as Iris.set.

fun skipLine()

skip line.

fun skipLines(count: Expr)
fun skipLines(count: Long)

skip count lines.

Declares a name that is deliberately left undefined, as Iris.undefined.