pub fn validate_tail_section_with_context(
content: &str,
section_name: &str,
) -> Result<(), ParseError>Expand description
Validates tail section content with enhanced context and error reporting.
This function provides comprehensive validation with informational messages about empty sections and detailed error reporting for formatting issues. It’s designed to give users clear guidance on how to fix their input files.
The function gracefully handles empty tail sections after comment filtering by providing informational context without causing errors. This is important because users may have tail sections that contain only comments, which become empty after filtering but should not cause the parsing to fail.
§Arguments
content- The tail section content to validatesection_name- The name of the section (e.g., “TAIL_a”, “TAIL_b”) for error reporting
§Returns
Ok(()) if the content is valid (including empty content), or Err(ParseError)
with detailed error information and suggestions for fixing issues
§Examples
use omecp::parser::validate_tail_section_with_context;
// Empty content is handled gracefully
assert!(validate_tail_section_with_context("", "TAIL_a").is_ok());
// Valid content passes validation
assert!(validate_tail_section_with_context("TD(NStates=5)", "TAIL_a").is_ok());