ass_core/parser/sections/styles/mod.rs
1//! Styles section parser for ASS scripts.
2//!
3//! Handles parsing of the [V4+ Styles] section which contains style definitions
4//! with format specifications and style entries.
5
6use crate::parser::{errors::ParseIssue, position_tracker::PositionTracker};
7use alloc::vec::Vec;
8
9mod parse_internal;
10mod parse_line;
11mod parser;
12
13#[cfg(test)]
14mod parse_tests;
15#[cfg(test)]
16mod style_line_tests;
17
18/// Parser for [V4+ Styles] section content
19///
20/// Parses format definitions and style entries from the styles section.
21/// Uses format mapping to handle different field orderings and missing fields.
22///
23/// # Performance
24///
25/// - Time complexity: O(n * m) for n styles and m fields per style
26/// - Memory: Zero allocations via lifetime-generic spans
27/// - Target: <1ms for typical style sections with 50 styles
28pub struct StylesParser<'a> {
29 /// Position tracker for accurate span generation
30 tracker: PositionTracker<'a>,
31 /// Parse issues and warnings collected during parsing
32 issues: Vec<ParseIssue>,
33 /// Format fields for the styles section
34 format: Option<Vec<&'a str>>,
35}