diff options
author | Melody Horn <melody@boringcactus.com> | 2021-03-31 13:23:32 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-03-31 13:23:32 -0600 |
commit | 9666eea62b8cf763027d1f01acbb403c1c6097e0 (patch) | |
tree | fb7f825089323ac8ef19203e7ff80f41156ce01b /src/makefile/conditional.rs | |
parent | 9d3e0824a0966c648e951e5928c241700ee931fb (diff) | |
download | makers-9666eea62b8cf763027d1f01acbb403c1c6097e0.tar.gz makers-9666eea62b8cf763027d1f01acbb403c1c6097e0.zip |
issuing correction on a previous post of mine, regarding pub(crate)
Diffstat (limited to 'src/makefile/conditional.rs')
-rw-r--r-- | src/makefile/conditional.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/makefile/conditional.rs b/src/makefile/conditional.rs index bf373bd..a3c3e0d 100644 --- a/src/makefile/conditional.rs +++ b/src/makefile/conditional.rs @@ -1,6 +1,6 @@ use super::token::TokenString; -pub(crate) enum ConditionalLine { +pub enum ConditionalLine { /// spelled "ifeq" IfEqual(TokenString, TokenString), /// spelled "ifneq" @@ -17,7 +17,7 @@ pub(crate) enum ConditionalLine { EndIf, } -pub(crate) enum ConditionalState { +pub enum ConditionalState { /// we saw a conditional, the condition was true, we're executing now /// and if we hit an else we will start SkippingUntilEndIf Executing, @@ -32,7 +32,7 @@ pub(crate) enum ConditionalState { } impl ConditionalState { - pub(crate) const fn skipping(&self) -> bool { + pub const fn skipping(&self) -> bool { match self { Self::Executing => false, Self::SkippingUntilElseOrEndIf | Self::SkippingUntilEndIf => true, @@ -40,14 +40,14 @@ impl ConditionalState { } } -pub(crate) enum ConditionalStateAction { +pub enum ConditionalStateAction { Push(ConditionalState), Replace(ConditionalState), Pop, } impl ConditionalStateAction { - pub(crate) fn apply_to(self, stack: &mut Vec<ConditionalState>) { + pub fn apply_to(self, stack: &mut Vec<ConditionalState>) { match self { Self::Push(state) => stack.push(state), Self::Replace(state) => match stack.last_mut() { @@ -78,7 +78,7 @@ fn decode_condition_args(line_body: &str) -> Option<(TokenString, TokenString)> } impl ConditionalLine { - pub(crate) fn from( + pub fn from( line: &str, expand_macro: impl Fn(&TokenString) -> anyhow::Result<String>, ) -> anyhow::Result<Option<Self>> { @@ -110,7 +110,7 @@ impl ConditionalLine { })) } - pub(crate) fn action( + pub fn action( &self, current_state: Option<&ConditionalState>, is_macro_defined: impl Fn(&str) -> bool, |