RawToken

RawToken

data class RawToken

Special Token implementation, used by the actual tokens to build instances of themselves against.

Fields

Name Description
val sequence: CharSequence
val context: ParseContext?

Location of where the token was found in the .wast file.

Constructors

<init>

constructor(sequence: CharSequence, context: ParseContext?)

Special Token implementation, used by the actual tokens to build instances of themselves against.

Parameters

Name Description
sequence: CharSequence
context: ParseContext?

Extensions

findFloatLiteral

fun RawToken.findFloatLiteral(): TokenMatchResult?

Receiver

Name Description
RawToken

ReturnValue

Name Description
TokenMatchResult?

isFloatLiteral

fun RawToken.isFloatLiteral(): Boolean

Receiver

Name Description
RawToken

ReturnValue

Name Description
Boolean

toFloatLiteral

fun RawToken.toFloatLiteral(): FloatLiteral

Receiver

Name Description
RawToken

ReturnValue

Name Description
FloatLiteral

findIdentifier

fun RawToken.findIdentifier(): TokenMatchResult?

Receiver

Name Description
RawToken

ReturnValue

Name Description
TokenMatchResult?

isIdentifier

fun RawToken.isIdentifier(): Boolean

Receiver

Name Description
RawToken

ReturnValue

Name Description
Boolean

toIdentifier

fun RawToken.toIdentifier(): Identifier

Receiver

Name Description
RawToken

ReturnValue

Name Description
Identifier

findIntegerLiteral

fun RawToken.findIntegerLiteral(): TokenMatchResult?

Receiver

Name Description
RawToken

ReturnValue

Name Description
TokenMatchResult?

isIntegerLiteral

fun RawToken.isIntegerLiteral(): Boolean

Receiver

Name Description
RawToken

ReturnValue

Name Description
Boolean

toIntegerLiteral

fun RawToken.toIntegerLiteral(): IntegerLiteral<*>

Receiver

Name Description
RawToken

ReturnValue

Name Description
IntegerLiteral<*>

findKeyword

fun RawToken.findKeyword(): TokenMatchResult?

Receiver

Name Description
RawToken

ReturnValue

Name Description
TokenMatchResult?

isKeyword

fun RawToken.isKeyword(): Boolean

Receiver

Name Description
RawToken

ReturnValue

Name Description
Boolean

toKeyword

fun RawToken.toKeyword(): Keyword

Receiver

Name Description
RawToken

ReturnValue

Name Description
Keyword

findParen

fun RawToken.findParen(): TokenMatchResult?

Receiver

Name Description
RawToken

ReturnValue

Name Description
TokenMatchResult?

isOpenParen

fun RawToken.isOpenParen(): Boolean

Receiver

Name Description
RawToken

ReturnValue

Name Description
Boolean

isClosedParen

fun RawToken.isClosedParen(): Boolean

Receiver

Name Description
RawToken

ReturnValue

Name Description
Boolean

toParen

fun RawToken.toParen(): Paren

Receiver

Name Description
RawToken

ReturnValue

Name Description
Paren

findReserved

fun RawToken.findReserved(): TokenMatchResult?

Receiver

Name Description
RawToken

ReturnValue

Name Description
TokenMatchResult?

isReserved

fun RawToken.isReserved(): Boolean

Receiver

Name Description
RawToken

ReturnValue

Name Description
Boolean

toReserved

fun RawToken.toReserved(): Reserved

Receiver

Name Description
RawToken

ReturnValue

Name Description
Reserved

findStringLiteral

fun RawToken.findStringLiteral(): TokenMatchResult?

Receiver

Name Description
RawToken

ReturnValue

Name Description
TokenMatchResult?

isStringLiteral

fun RawToken.isStringLiteral(): Boolean

Receiver

Name Description
RawToken

ReturnValue

Name Description
Boolean

toStringLiteral

fun RawToken.toStringLiteral(): StringLiteral

Receiver

Name Description
RawToken

ReturnValue

Name Description
StringLiteral

isKeyword

fun Token.isKeyword(keywordValue: String): Boolean

Determines whether or not the Token is a Keyword matching the provided keywordValue.

Receiver

Name Description
Token

Parameters

Name Description
keywordValue: String

ReturnValue

Name Description
Boolean

asKeywordMatching

fun Token.asKeywordMatching(value: String): Keyword?

Casts the Token into a Keyword and returns it if its Keyword.value is value. Returns null if either condition is unmet.

Receiver

Name Description
Token

Parameters

Name Description
value: String

ReturnValue

Name Description
Keyword?

asKeywordMatching

fun Token.asKeywordMatching(regex: Regex): Pair<Keyword, MatchResult>?

Casts the Token into a Keyword and returns it, along with the match, if its Keyword.value matches regexp.

Returns null if neither condition is met.

Receiver

Name Description
Token

Parameters

Name Description
regex: Regex

ReturnValue

Name Description
Pair<Keyword, MatchResult>?

assertIsKeyword

fun Token.assertIsKeyword(keywordValue: String)

Asserts that the Token is a Keyword matching the provided keywordValue.

Receiver

Name Description
Token

Parameters

Name Description
keywordValue: String

ReturnValue

Name Description
Unit