ass_core/parser/sections/events/mod.rs
1//! Events section parser for ASS scripts.
2//!
3//! Handles parsing of the `[Events]` section which contains dialogue, comments,
4//! and other timed events with format specifications and event entries.
5
6mod event_data;
7mod parser;
8mod static_parser;
9
10#[cfg(test)]
11mod static_tests;
12#[cfg(test)]
13mod streaming_tests;
14
15use crate::parser::{errors::ParseIssue, position_tracker::PositionTracker};
16use alloc::vec::Vec;
17
18/// Parser for `[Events]` section content
19///
20/// Parses format definitions and event entries from the events section.
21/// Uses format mapping to handle different field orderings and event types.
22///
23/// # Performance
24///
25/// - Time complexity: O(n * m) for n events and m fields per event
26/// - Memory: Zero allocations via lifetime-generic spans
27/// - Target: <2ms for typical event sections with 1000 events
28pub struct EventsParser<'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 events section
34 format: Option<Vec<&'a str>>,
35}