Skip to main content
← OpenMECP Documentation

validate_tail_section

Function validate_tail_section 

Source
pub fn validate_tail_section(
    content: &str,
    section_name: &str,
) -> Result<(), ParseError>
Expand description

Validates tail section content for Gaussian compatibility.

This function performs comprehensive validation of tail section content after comment filtering to ensure it will work correctly with Gaussian. It checks for proper syntax and provides meaningful error messages with specific suggestions for fixing common formatting issues.

§Arguments

  • content - The tail section content to validate
  • section_name - The name of the section (e.g., “TAIL_a”, “TAIL_b”) for error reporting

§Returns

Ok(()) if the content is valid, or Err(ParseError) with details about the validation failure including the section name and helpful suggestions

§Examples

use omecp::parser::validate_tail_section;

// Valid content
assert!(validate_tail_section("TD(NStates=5) Root=1", "TAIL_a").is_ok());

// Empty content is acceptable
assert!(validate_tail_section("", "TAIL_a").is_ok());

// Invalid content with comments (should be filtered before validation)
assert!(validate_tail_section("TD(NStates=5) # comment", "TAIL_a").is_err());