Skip to main content

scan_text_segments

Function scan_text_segments 

Source
pub fn scan_text_segments(
    text: &str,
) -> Result<Vec<TextToken<'_>>, MarkupScanError>
Expand description

Scans text for {expr} and [markup] syntax, yielding tokens in order.

Markup rules:

An unclosed { or [ (no matching } / ] before end of input) is always an error regardless of the content inside.

§Errors

Returns MarkupScanError::UnclosedBrace or MarkupScanError::UnclosedBracket with the byte offset of the unmatched delimiter.