token: Add new keywords in preparation for grammar update

This commit is contained in:
John 2024-01-06 14:32:56 -06:00
parent 77f7623041
commit 15d7565703

View File

@ -77,18 +77,22 @@ pub enum Type {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum Keyword {
Break,
Cl,
Continue,
Else,
Enum,
False,
For,
Fn,
If,
In,
Let,
Mod,
Mut,
Return,
SelfKw,
SelfTy,
Struct,
Super,
True,
While,
@ -167,18 +171,22 @@ impl Display for Keyword {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Break => "break".fmt(f),
Self::Cl => "cl".fmt(f),
Self::Continue => "continue".fmt(f),
Self::Else => "else".fmt(f),
Self::Enum => "enum".fmt(f),
Self::False => "false".fmt(f),
Self::For => "for".fmt(f),
Self::Fn => "fn".fmt(f),
Self::If => "if".fmt(f),
Self::In => "in".fmt(f),
Self::Let => "let".fmt(f),
Self::Mod => "mod".fmt(f),
Self::Mut => "mut".fmt(f),
Self::Return => "return".fmt(f),
Self::SelfKw => "self".fmt(f),
Self::SelfTy => "Self".fmt(f),
Self::Struct => "struct".fmt(f),
Self::Super => "super".fmt(f),
Self::True => "true".fmt(f),
Self::While => "while".fmt(f),
@ -191,18 +199,22 @@ impl FromStr for Keyword {
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(match s {
"break" => Self::Break,
"cl" => Self::Cl,
"continue" => Self::Continue,
"else" => Self::Else,
"enum" => Self::Enum,
"false" => Self::False,
"for" => Self::For,
"fn" => Self::Fn,
"if" => Self::If,
"in" => Self::In,
"let" => Self::Let,
"mod" => Self::Mod,
"mut" => Self::Mut,
"return" => Self::Return,
"self" => Self::SelfKw,
"Self" => Self::SelfTy,
"struct" => Self::Struct,
"super" => Self::Super,
"true" => Self::True,
"while" => Self::While,