Kwasm.format.text.token.util
package kwasm.format.text.token.util
Classes
Name | Description |
---|---|
class Frac
|
From the docs.
|
class Num
|
From the docs. All integers can be written in either decimal or hexadecimal notation. In both cases, digits can optionally be separated by underscores.
|
data class StringChar
|
Represents a single character as a unicode codepoint, and its original length in a wast file as part of a string literal. |
data class CanonincalNaN
|
From the docs. |
data class TokenMatchResult
|
Return value of RawToken's |
Fields
Name | Description |
---|---|
const STRINGCHAR_PATTERN: String
|
Pattern to check for valid StringChar elements. From the docs:
|
const STRINGELEM_PATTERN: String
|
From the docs:
|
Methods
parseLongSign
fun CharSequence.parseLongSign(): Pair
Receiver
Name | Description |
---|---|
CharSequence
|
ReturnValue
Name | Description |
---|---|
Pair
|
parseDigit
fun CharSequence.parseDigit(index: Int, context: ParseContext?): Byte
Parses a digit (as a Byte) from the receiving CharSequence at the given index.
Receiver
Name | Description |
---|---|
CharSequence
|
Parameters
Name | Description |
---|---|
index: Int
|
|
context: ParseContext?
|
ReturnValue
Name | Description |
---|---|
Byte
|
parseStringElem
fun CharSequence.parseStringElem(index: Int, inoutVal: StringChar, context: ParseContext?): StringChar
Parses a stringelem
from the receiving CharSequence at the given index as a StringChar.
From the docs:
stringelem ::= s:stringchar => s as StringChar
'∖' n:hexdigit m:hexdigit => StringChar(16 * n + m, 3)
Receiver
Name | Description |
---|---|
CharSequence
|
Parameters
Name | Description |
---|---|
index: Int
|
|
inoutVal: StringChar
|
|
context: ParseContext?
|
ReturnValue
Name | Description |
---|---|
StringChar
|
parseStringChar
fun CharSequence.parseStringChar(index: Int, inoutVal: StringChar, context: ParseContext?): StringChar
Parses a StringChar from the receiving CharSequence at the given index.
From the docs:
stringchar ::= c:char => c (if c ≥ U+20 ∧ c ≠ U+7F ∧ c ≠ ‘"’ ∧ c ≠ ‘∖’)
'∖t' => U+09
'∖n' => U+0A
'∖r' => U+0D
'∖"' => U+22
'∖'' => U+27
'∖' => U+5C
'∖u{' n:hexnum '}' => U+(n) (if n < 0xD800 ∨ 0xE000 ≤ n < 0x110000)
Receiver
Name | Description |
---|---|
CharSequence
|
Parameters
Name | Description |
---|---|
index: Int
|
|
inoutVal: StringChar
|
|
context: ParseContext?
|
ReturnValue
Name | Description |
---|---|
StringChar
|
parseDigit
fun IntArray.parseDigit(index: Int, context: ParseContext?): Byte
Receiver
Name | Description |
---|---|
IntArray
|
Parameters
Name | Description |
---|---|
index: Int
|
|
context: ParseContext?
|
ReturnValue
Name | Description |
---|---|
Byte
|
parseStringElem
fun IntArray.parseStringElem(index: Int, inoutVal: StringChar, context: ParseContext?): StringChar
Receiver
Name | Description |
---|---|
IntArray
|
Parameters
Name | Description |
---|---|
index: Int
|
|
inoutVal: StringChar
|
|
context: ParseContext?
|
ReturnValue
Name | Description |
---|---|
StringChar
|
parseStringChar
fun IntArray.parseStringChar(index: Int, inoutVal: StringChar, context: ParseContext?): StringChar
Receiver
Name | Description |
---|---|
IntArray
|
Parameters
Name | Description |
---|---|
index: Int
|
|
inoutVal: StringChar
|
|
context: ParseContext?
|
ReturnValue
Name | Description |
---|---|
StringChar
|
parseDigit
fun Char.parseDigit(context: ParseContext?): Byte
Receiver
Name | Description |
---|---|
Char
|
Parameters
Name | Description |
---|---|
context: ParseContext?
|
ReturnValue
Name | Description |
---|---|
Byte
|
significand
fun Int.significand(context: ParseContext?): Int
From the docs.
Receiver
Name | Description |
---|---|
Int
|
Parameters
Name | Description |
---|---|
context: ParseContext?
|
ReturnValue
Name | Description |
---|---|
Int
|
expon
fun Int.expon(context: ParseContext?): Int
From the docs.
Receiver
Name | Description |
---|---|
Int
|
Parameters
Name | Description |
---|---|
context: ParseContext?
|
ReturnValue
Name | Description |
---|---|
Int
|
canon
fun Int.canon(context: ParseContext?): Long
From the docs.
Receiver
Name | Description |
---|---|
Int
|
Parameters
Name | Description |
---|---|
context: ParseContext?
|
ReturnValue
Name | Description |
---|---|
Long
|
Parses a sign (
+
or-
) from the beginning of the receiving CharSequence, and returns the sign value and intended offset for parsing the remainder of the value.