2022-06-18 21:56:31 -07:00
|
|
|
use super::*;
|
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,
|
2022-10-19 19:00:09 -07:00
|
|
|
Fallback,
|
2021-03-28 22:38:07 -07:00
|
|
|
False,
|
2020-10-26 18:16:42 -07:00
|
|
|
If,
|
2022-10-04 17:32:30 -07:00
|
|
|
IgnoreComments,
|
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,
|
2022-05-31 13:01:59 -07:00
|
|
|
WindowsShell,
|
2022-10-25 16:57:20 -07:00
|
|
|
Tempdir,
|
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
|
|
|
|
}
|
|
|
|
}
|