#[non_exhaustive]pub enum TokenRole {
}Expand description
What a token means when it is lowered on its own.
§Examples
use lower_lang::{Escapes, TokenRole};
let var = TokenRole::Var { sigil: 1 }; // `$name`, name `name`
let string = TokenRole::Str(Escapes::Standard);
assert_ne!(var, string);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Name
An identifier: a name, a variable reference, a binding, or a type name.
Var
A sigiled variable such as $x; the first sigil bytes are not part
of the name.
Label
A loop label such as 'outer.
Lifetime
A region (lifetime) such as 'a, as a generic parameter or argument.
Int
An integer literal (0x, 0o, 0b prefixes and _ separators
accepted; a registered suffix sets its type).
Float
A floating-point literal.
Number
A number: a float if it has a fraction or an exponent, else an integer.
Str(Escapes)
A string literal, quotes included in the token.
Char(Escapes)
A character literal, quotes included.
Bytes(Escapes)
A byte-string literal, quotes (and a leading b) included.
True
true.
False
false.
Null
null / nil / None-as-keyword.
Wild
_: a wildcard pattern, or an inferred type.
Rest
.. inside a pattern.
Type(TypeName)
A type keyword (int, mixed, Self, !).