syntax.TokenKind
Valuetype pub copy enum TokenKindConstructors
Comment
Comment()A single or multi-line comment.
Field
Field()A reference to a field, such as self.foo in Rust or @foo in Inko.
Float
Float()A float (e.g. 10.5 or 10e5).
Int
Int()An integer.
Keyword
Keyword()A keyword, such as class.
Macro
Macro()A macro definition or call (i.e. vec![...] in Rust or a #define in C).
String
String()A string.
Symbol
Symbol()A symbol/atom, such as :foo in Ruby.
Text
Text()Regular text, such as unrecognized/highlighted words or whitespace.
Instance methods
!=
Show source codeHide source code
fn pub !=(other: ref Self) -> Bool {
(self == other).false?
}fn pub !=(other: ref Self) -> BoolReturns true if self and the given object are not equal to each other.
==
Show source codeHide source code
fn pub ==(other: ref TokenKind) -> Bool {
match (self, other) {
case (Comment, Comment) -> true
case (String, String) -> true
case (Int, Int) -> true
case (Float, Float) -> true
case (Text, Text) -> true
case (Keyword, Keyword) -> true
case (Field, Field) -> true
case (Symbol, Symbol) -> true
case (Macro, Macro) -> true
case _ -> false
}
}fn pub ==(other: TokenKind) -> BoolReturns true if self and the given object are equal to each other.
This operator is used to perform structural equality. This means two objects residing in different memory locations may be considered equal, provided their structure is equal. For example, two different arrays may be considered to have structural equality if they contain the exact same values.
fmt
Show source codeHide source code
fn pub fmt(formatter: mut Formatter) {
match self {
case Comment -> formatter.tuple('Comment').finish
case String -> formatter.tuple('String').finish
case Int -> formatter.tuple('Int').finish
case Float -> formatter.tuple('Float').finish
case Text -> formatter.tuple('Text').finish
case Keyword -> formatter.tuple('Keyword').finish
case Field -> formatter.tuple('Field').finish
case Symbol -> formatter.tuple('Symbol').finish
case Macro -> formatter.tuple('Macro').finish
}
}fn pub fmt(formatter: mut Formatter)Formats self in a human-readable format for debugging purposes.
hash
Show source codeHide source code
fn pub hash[H: mut + Hasher](hasher: mut H) {
let val = match self {
case Comment -> 0
case String -> 1
case Int -> 2
case Float -> 3
case Text -> 4
case Keyword -> 5
case Field -> 6
case Symbol -> 7
case Macro -> 8
}
hasher.write(val)
}fn pub hash[H: mut + Hasher](hasher: mut H: mut)Writes the hash for self into the given Hasher.
Implemented traits
Equal
impl Equal for TokenKindFormat
impl Format for TokenKindHash
impl Hash for TokenKind