///|
/// Return the strict modern parser configuration used by report APIs.
pub fn strict_parse_config() -> ParseConfig {
{
mode: ModernCanonical,
accept_lowercase: true,
accept_unicode: false,
trim_outer_whitespace: false,
}
}
///|
/// Return a modern parser configuration with Unicode and outer trimming.
pub fn compatibility_parse_config() -> ParseConfig {
{
mode: ModernCanonical,
accept_lowercase: true,
accept_unicode: true,
trim_outer_whitespace: true,
}
}
///|
/// Return a deterministic additive-profile parser configuration.
pub fn additive_parse_config() -> ParseConfig {
{ ..strict_parse_config(), mode: AdditiveHistorical }
}
///|
/// Return a clock-profile parser configuration.
pub fn clock_parse_config() -> ParseConfig {
{ ..strict_parse_config(), mode: ClockFace }
}
///|
/// Return a parenthesized-thousands parser configuration.
pub fn extended_parse_config() -> ParseConfig {
{ ..strict_parse_config(), mode: ParenthesizedThousands }
}
///|
/// Return an uppercase modern formatter configuration.
pub fn modern_format_config() -> FormatConfig {
{ mode: ModernCanonical, letter_case: Uppercase }
}
///|
/// Return an uppercase additive formatter configuration.
pub fn additive_format_config() -> FormatConfig {
{ mode: AdditiveHistorical, letter_case: Uppercase }
}
///|
/// Return an uppercase clock formatter configuration.
pub fn clock_format_config() -> FormatConfig {
{ mode: ClockFace, letter_case: Uppercase }
}
///|
/// Return an uppercase parenthesized-thousands formatter configuration.
pub fn extended_format_config() -> FormatConfig {
{ mode: ParenthesizedThousands, letter_case: Uppercase }
}
///|
/// Return a formatter configuration for lowercase output in a selected mode.
pub fn lowercase_format_config(mode : RomanMode) -> FormatConfig {
{ mode, letter_case: Lowercase }
}
///|
/// Validate scanner limits before processing text.
pub fn validate_scan_config(config : ScanConfig) -> Result[Unit, ConfigError] {
if config.max_candidate_length < 1 {
Err(InvalidCandidateLength(config.max_candidate_length))
} else {
Ok(())
}
}