29 lines
645 B
Rust
29 lines
645 B
Rust
pub enum Keywords {
|
|
Type,
|
|
Enum,
|
|
Import,
|
|
Service,
|
|
Define,
|
|
}
|
|
|
|
impl Keywords {
|
|
pub fn is_keyword(input: &str) -> bool {
|
|
match input {
|
|
"type" | "enum" | "import" | "service" | "define" => true,
|
|
_ => false,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl ToString for Keywords {
|
|
fn to_string(&self) -> String {
|
|
match self {
|
|
Keywords::Type => "type".to_string(),
|
|
Keywords::Enum => "enum".to_string(),
|
|
Keywords::Import => "import".to_string(),
|
|
Keywords::Service => "service".to_string(),
|
|
Keywords::Define => "define".to_string(),
|
|
}
|
|
}
|
|
}
|