Skip to content

Commit

Permalink
feat: stabilize include directive
Browse files Browse the repository at this point in the history
  • Loading branch information
jcornaz committed Feb 5, 2023
1 parent d5ae15b commit 60c7a2b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
16 changes: 0 additions & 16 deletions src/directive.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::assertion::assertion;
use crate::close::close;
#[cfg(feature = "unstable")]
use crate::include::{include, Include};
use crate::open::open;
use crate::price::{price, Price};
Expand Down Expand Up @@ -29,7 +28,6 @@ pub enum Directive<'a> {
/// The [`Assertion`](crate::Assertion) (`balance`) account directive
Assertion(Assertion<'a>),
/// The [`Include`](crate::Include) directive
#[cfg(feature = "unstable")]
Include(Include),
}

Expand Down Expand Up @@ -65,24 +63,11 @@ impl<'a> Directive<'a> {
Directive::Close(c) => Some(c.date()),
Directive::Price(p) => Some(p.date()),
Directive::Assertion(a) => Some(a.date()),
#[cfg(feature = "unstable")]
Directive::Include(_) => None,
}
}
}

#[cfg(not(feature = "unstable"))]
pub(crate) fn directive(input: &str) -> IResult<&str, Directive<'_>> {
alt((
map(transaction, Directive::Transaction),
map(price, Directive::Price),
map(open, Directive::Open),
map(close, Directive::Close),
map(assertion, Directive::Assertion),
))(input)
}

#[cfg(feature = "unstable")]
pub(crate) fn directive(input: &str) -> IResult<&str, Directive<'_>> {
alt((
map(transaction, Directive::Transaction),
Expand Down Expand Up @@ -140,7 +125,6 @@ mod tests {
}

#[test]
#[cfg(feature = "unstable")]
fn include_directive() {
use nom::combinator::all_consuming;
let (_, directive) = all_consuming(directive)(r#"include "myfile.beancount""#).unwrap();
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ mod close;
mod date;
mod directive;
mod error;
#[cfg(feature = "unstable")]
mod include;
mod metadata;
mod open;
Expand All @@ -72,7 +71,6 @@ pub use crate::{
directive::Directive, error::Error, open::Open, price::Price, transaction::Transaction,
};

#[cfg(feature = "unstable")]
pub use crate::include::Include;

use nom::{
Expand Down

0 comments on commit 60c7a2b

Please sign in to comment.