kwasm.format

Kwasm.format

package kwasm.format

Classes

Name Description
data class ParseContext

Reflects the current location within a text-based wasm module.

Primarily used in conjunction with ParseException.

data class ParseException

An exception which is thrown by the text-based wasm interpreter when a parsing error occurs during evaluation.

Subpackages

Name Description
package kwasm.format.binary
package kwasm.format.text

Methods

shiftColumnBy

fun ParseContext?.shiftColumnBy(amount: Int): ParseContext?

Returns a new ParseContext with the ParseContext.column value shifted by the given amount, or null if the receiver is null.

Receiver

Name Description
ParseContext?

Parameters

Name Description
amount: Int

ReturnValue

Name Description
ParseContext?

shiftLineNumberBy

fun ParseContext?.shiftLineNumberBy(amount: Int): ParseContext?

Returns a new ParseContext with the ParseContext.lineNumber value shifted by the given amount or null if the receiver is null.

Receiver

Name Description
ParseContext?

Parameters

Name Description
amount: Int

ReturnValue

Name Description
ParseContext?

parseCheck

inline fun parseCheck(context: ParseContext?, condition: Boolean, crossinline message: ()->String)

Throws a ParseException if the condition is not met.

Parameters

Name Description
context: ParseContext?
condition: Boolean
crossinline message: ()->String

ReturnValue

Name Description
Unit

parseCheck

fun parseCheck(context: ParseContext?, condition: Boolean, message: String?)

Throws a ParseException if the condition is not met.

Parameters

Name Description
context: ParseContext?
condition: Boolean
message: String?

ReturnValue

Name Description
Unit

parseCheckNotNull

inline fun <T> parseCheckNotNull(context: ParseContext?, value: T?, crossinline message: ()->String): T

Returns a non-nullable T value if it's not null, otherwise: throws a ParseException.

Parameters

Name Description
context: ParseContext?
value: T?
crossinline message: ()->String

ReturnValue

Name Description
T

parseCheckNotNull

fun <T> parseCheckNotNull(context: ParseContext?, value: T?, message: String?): T

Returns a non-nullable T value if it's not null, otherwise: throws a ParseException.

Parameters

Name Description
context: ParseContext?
value: T?
message: String?

ReturnValue

Name Description
T