pub enum Token {
Show 61 variants
Do,
Let,
In,
Where,
If,
Then,
Else,
Case,
Of,
Guard,
Not,
ModKw,
DivKw,
Otherwise,
True,
False,
Nothing,
Int(i64),
Float(f64),
Str(String),
Ident(String),
UpperIdent(String),
Arrow,
LeftArrow,
FatArrow,
DoubleColon,
DotDot,
EqEq,
Neq,
Lte,
Gte,
AndAnd,
OrOr,
PlusPlus,
Plus,
Minus,
Star,
Slash,
Percent,
Lt,
Gt,
Eq,
Dot,
Comma,
Colon,
Pipe,
Backslash,
At,
Ampersand,
Backtick,
Bang,
LParen,
RParen,
LBracket,
RBracket,
LBrace,
RBrace,
Indent,
Dedent,
Newline,
Eof,
}Expand description
Token kinds produced by the lexer.
Keywords are recognized during lexing; identifiers that happen to match
a keyword are emitted as the keyword token, not as Ident.
Variants§
Do
do keyword (layout block).
Let
let keyword (layout block).
In
in keyword.
Where
where keyword (layout block).
If
if keyword.
Then
then keyword.
Else
else keyword.
Case
case keyword.
Of
of keyword (layout block).
Guard
guard keyword.
Not
not keyword (logical negation).
ModKw
mod keyword (modulo).
DivKw
div keyword (integer division).
Otherwise
otherwise keyword (catch-all guard).
True
Boolean literal True.
False
Boolean literal False.
Nothing
Nothing literal (absent value).
Int(i64)
Integer literal (decimal or 0x hex).
Float(f64)
Floating-point literal.
Str(String)
String literal (double-quoted, backslash escapes).
Ident(String)
Lower-case identifier (variables, fields).
UpperIdent(String)
Upper-case identifier (constructors, types).
Arrow
-> arrow (function type, edge traversal).
LeftArrow
<- left arrow (generators, monadic bind).
FatArrow
=> fat arrow (constraints, pattern clauses).
DoubleColon
:: type annotation.
DotDot
.. range operator.
EqEq
== equality.
Neq
/= inequality.
Lte
<= less-than-or-equal.
Gte
>= greater-than-or-equal.
AndAnd
&& logical and.
OrOr
|| logical or.
PlusPlus
++ list concatenation.
Plus
+ addition.
Minus
- subtraction / negation.
Star
* multiplication.
Slash
/ division.
Percent
% modulo.
Lt
< less-than.
Gt
> greater-than.
Eq
= binding / definition.
Dot
. field access / composition.
Comma
, separator.
Colon
: cons / type annotation.
Pipe
| guard / comprehension separator.
Backslash
\ lambda introducer.
At
@ as-pattern.
Ampersand
& reference.
Backtick
` infix function application.
Bang
! strict application.
LParen
( open parenthesis.
RParen
) close parenthesis.
LBracket
[ open bracket.
RBracket
] close bracket.
LBrace
{ open brace.
RBrace
} close brace.
Indent
Indentation increased (opens a block).
Dedent
Indentation decreased (closes a block).
Newline
Newline at the same indentation level (separates declarations).
Eof
End of input.
Trait Implementations§
Source§impl<'s> Logos<'s> for Token
impl<'s> Logos<'s> for Token
Source§type Error = ()
type Error = ()
#[logos(error = MyError)]. Defaults to () if not set.Source§type Extras = ()
type Extras = ()
Extras for the particular lexer. This can be set using
#[logos(extras = MyExtras)] and accessed inside callbacks.Source§type Source = str
type Source = str
str,
unless one of the defined patterns explicitly uses non-unicode byte values
or byte slices, in which case that implementation will use [u8].Source§fn lex(
lex: &mut Lexer<'s, Self>,
) -> Option<Result<Self, <Self as Logos<'s>>::Error>>
fn lex( lex: &mut Lexer<'s, Self>, ) -> Option<Result<Self, <Self as Logos<'s>>::Error>>
Lexer. The implementation for this function
is generated by the logos-derive crate.