Identifier
class Identifier
Fields
Name | Description |
---|---|
val value: String
|
|
val context: ParseContext?
|
Location of where the token was found in the .wast file. |
Constructors
<init>
constructor(sequence: CharSequence, context: ParseContext?)
From the docs:
Indices can be given in both numeric and symbolic form. Symbolic identifiers that stand in lieu
of indices start with $
, followed by any sequence of printable ASCII characters that does not
contain a space, quotation mark, comma, semicolon, or bracket.
id ::= '$' idchar+
idchar ::= '0', '1', ..., '9'
'A', 'B', ..., 'Z'
'a', 'b', ..., 'z'
'!', '#', '$', '%', '&', ''', '*', '+', '-', '.', '/'
':', '<', '=', '>', '?', '@', '', '^', '_', '`', '|', '~'
Parameters
Name | Description |
---|---|
sequence: CharSequence
|
|
context: ParseContext?
|
Methods
equals
fun equals(other: Any?): Boolean
Parameters
Name | Description |
---|---|
other: Any?
|
ReturnValue
Name | Description |
---|---|
Boolean
|
getAstValue
fun <IdentifierType : Identifier> getAstValue(): IdentifierType
Gets an instance of a kwasm.ast.Identifier based on the value.
ReturnValue
Name | Description |
---|---|
IdentifierType
|
Extensions
isKeyword
fun Token.isKeyword(keywordValue: String): Boolean
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
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
|
From the docs:
Indices can be given in both numeric and symbolic form. Symbolic identifiers that stand in lieu of indices start with
$
, followed by any sequence of printable ASCII characters that does not contain a space, quotation mark, comma, semicolon, or bracket.