Skip to content

Commit

Permalink
More cfgs
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Feb 12, 2025
1 parent aad2371 commit 16abd98
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/plurals/src/provider/rules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@
//! [`Sample`]: super::rules::reference::ast::Samples
//! [`AST`]: super::rules::reference::ast
pub mod reference;
pub mod runtime;

// The runtime module is used internally, but is only needed externally in datagen mode
// The reference module is used internally, but is only needed externally in datagen mode
#[cfg(feature = "datagen")]
pub mod runtime;
pub mod reference;
#[cfg(not(feature = "datagen"))]
pub(crate) mod runtime;
pub(crate) mod reference;

// Need to expose it for datagen, but we don't
// have a reason to make it fully public, so hiding docs for now.
Expand Down
6 changes: 6 additions & 0 deletions components/plurals/src/provider/rules/reference/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@
//! guaranteed to match with this version's `*_unstable` providers. Use with caution.
//! </div>
pub mod ast;
#[cfg(feature = "serde")]
pub(crate) mod lexer;
#[cfg(feature = "serde")]
pub(crate) mod parser;
#[cfg(feature = "datagen")]
pub(crate) mod resolver;
pub(crate) mod serializer;

#[cfg(feature = "datagen")]
pub use lexer::Lexer;
#[cfg(feature = "datagen")]
pub use parser::{parse, parse_condition};
#[cfg(feature = "datagen")]
pub use resolver::test_condition;
pub use serializer::serialize;
2 changes: 2 additions & 0 deletions components/plurals/src/provider/rules/reference/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ pub fn parse(input: &[u8]) -> Result<ast::Rule, ParseError> {
/// [`test_condition`]: super::test_condition
/// [`PluralOperands`]: crate::PluralOperands
/// [`PluralCategory`]: crate::PluralCategory
#[cfg(feature = "datagen")]
pub fn parse_condition(input: &[u8]) -> Result<ast::Condition, ParseError> {
let parser = Parser::new(input);
parser.parse_condition()
Expand All @@ -125,6 +126,7 @@ impl<'p> Parser<'p> {
self.get_rule()
}

#[cfg(feature = "datagen")]
pub fn parse_condition(mut self) -> Result<ast::Condition, ParseError> {
self.get_condition()
}
Expand Down

0 comments on commit 16abd98

Please # to comment.