pub enum TokenContext {
Document,
SectionHeader,
FieldValue,
StyleOverride,
DrawingCommands,
UuEncodedData,
}Expand description
Tokenization context for state-aware parsing
Tracks current parsing context to enable context-sensitive tokenization of ASS script elements that have different lexical rules in different contexts.
Variants§
Document
Top-level document parsing
Default state for processing section headers, comments, and top-level document structure.
SectionHeader
Inside section header like [Events]
Special tokenization rules for section names within square brackets.
FieldValue
Inside field definition line
Field values have different whitespace and delimiter handling than other contexts.
StyleOverride
Inside style override block like {\b1}
Override tags use backslash prefixes and have special syntax rules.
DrawingCommands
Inside drawing commands (\p1)
Drawing commands use vector graphics syntax with different coordinate and command parsing rules.
UuEncodedData
Inside UU-encoded data (fonts/graphics)
Binary data sections use different character validation and line parsing rules.
Implementations§
Source§impl TokenContext
impl TokenContext
Sourcepub const fn allows_whitespace_skipping(self) -> bool
pub const fn allows_whitespace_skipping(self) -> bool
Check if context allows whitespace skipping
Sourcepub const fn is_delimited_block(self) -> bool
pub const fn is_delimited_block(self) -> bool
Check if context is inside a delimited block
Sourcepub const fn closing_delimiter(self) -> Option<char>
pub const fn closing_delimiter(self) -> Option<char>
Get expected closing delimiter for context
Sourcepub const fn enter_field_value(self) -> Self
pub const fn enter_field_value(self) -> Self
Transition to field value context after colon
Sourcepub const fn reset_to_document(self) -> Self
pub const fn reset_to_document(self) -> Self
Reset to document context (typically after newline)
Trait Implementations§
Source§impl Clone for TokenContext
impl Clone for TokenContext
Source§fn clone(&self) -> TokenContext
fn clone(&self) -> TokenContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more