-
Notifications
You must be signed in to change notification settings - Fork 905
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wgsl-in): create skeleton for parsing directives
- Loading branch information
1 parent
fc4f811
commit d8e73a7
Showing
3 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)] | ||
pub enum DirectiveKind { | ||
Unimplemented(UnimplementedDirectiveKind), | ||
} | ||
|
||
impl DirectiveKind { | ||
pub fn from_ident(s: &str) -> Option<(Self, &'static str)> { | ||
Some(match s { | ||
"diagnostic" => ( | ||
Self::Unimplemented(UnimplementedDirectiveKind::Diagnostic), | ||
"diagnostic", | ||
), | ||
"enable" => ( | ||
Self::Unimplemented(UnimplementedDirectiveKind::Enable), | ||
"enable", | ||
), | ||
"requires" => ( | ||
Self::Unimplemented(UnimplementedDirectiveKind::Requires), | ||
"requires", | ||
), | ||
_ => return None, | ||
}) | ||
} | ||
} | ||
|
||
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq)] | ||
pub enum UnimplementedDirectiveKind { | ||
Diagnostic, | ||
Enable, | ||
Requires, | ||
} | ||
|
||
impl UnimplementedDirectiveKind { | ||
pub const fn tracking_issue_num(self) -> u16 { | ||
match self { | ||
Self::Diagnostic => 5320, | ||
Self::Requires => 6350, | ||
Self::Enable => 5476, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters