token: reserve "and", "or", "in" as keywords
This commit is contained in:
@@ -235,6 +235,7 @@ impl<'t> Lexer<'t> {
|
||||
let token = self.produce(TKind::Identifier);
|
||||
Ok(Token {
|
||||
kind: match lexeme {
|
||||
"and" => TKind::And,
|
||||
"as" => TKind::As,
|
||||
"break" => TKind::Break,
|
||||
"const" => TKind::Const,
|
||||
@@ -244,11 +245,13 @@ impl<'t> Lexer<'t> {
|
||||
"fn" => TKind::Fn,
|
||||
"for" => TKind::For,
|
||||
"if" => TKind::If,
|
||||
"in" => TKind::In,
|
||||
"let" => TKind::Let,
|
||||
"loop" => TKind::Loop,
|
||||
"macro" => TKind::Macro,
|
||||
"match" => TKind::Match,
|
||||
"mod" => TKind::Module,
|
||||
"or" => TKind::Or,
|
||||
"pub" => TKind::Public,
|
||||
"return" => TKind::Return,
|
||||
"struct" => TKind::Struct,
|
||||
|
||||
@@ -56,6 +56,7 @@ impl std::fmt::Display for Lexeme {
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum TKind {
|
||||
Comment,
|
||||
And,
|
||||
As,
|
||||
Break,
|
||||
Const,
|
||||
@@ -65,11 +66,13 @@ pub enum TKind {
|
||||
Fn,
|
||||
For,
|
||||
If,
|
||||
In,
|
||||
Let,
|
||||
Loop,
|
||||
Macro,
|
||||
Match,
|
||||
Module,
|
||||
Or,
|
||||
Public,
|
||||
Return,
|
||||
Struct,
|
||||
|
||||
Reference in New Issue
Block a user