2020-10-26 18:16:42 -07:00
|
|
|
use crate::common::*;
|
2019-11-10 23:17:47 -08:00
|
|
|
|
2020-10-26 18:16:42 -07:00
|
|
|
#[derive(Debug, Eq, PartialEq, IntoStaticStr, Display, Copy, Clone, EnumString)]
|
|
|
|
#[strum(serialize_all = "kebab_case")]
|
|
|
|
pub(crate) enum Keyword {
|
|
|
|
Alias,
|
2022-02-14 18:37:06 -08:00
|
|
|
AllowDuplicateRecipes,
|
2021-04-24 18:29:58 -07:00
|
|
|
DotenvLoad,
|
2020-10-26 18:16:42 -07:00
|
|
|
Else,
|
|
|
|
Export,
|
2021-03-28 22:38:07 -07:00
|
|
|
False,
|
2020-10-26 18:16:42 -07:00
|
|
|
If,
|
2021-04-24 18:29:58 -07:00
|
|
|
PositionalArguments,
|
2020-10-26 18:16:42 -07:00
|
|
|
Set,
|
|
|
|
Shell,
|
2021-04-24 18:29:58 -07:00
|
|
|
True,
|
2022-01-18 11:02:15 -08:00
|
|
|
WindowsPowershell,
|
2020-10-26 18:16:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Keyword {
|
|
|
|
pub(crate) fn from_lexeme(lexeme: &str) -> Option<Keyword> {
|
|
|
|
lexeme.parse().ok()
|
|
|
|
}
|
|
|
|
|
|
|
|
pub(crate) fn lexeme(self) -> &'static str {
|
|
|
|
self.into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> PartialEq<&'a str> for Keyword {
|
|
|
|
fn eq(&self, other: &&'a str) -> bool {
|
|
|
|
self.lexeme() == *other
|
|
|
|
}
|
|
|
|
}
|