Skip to main content

Module interpolation

Module interpolation 

Source
Expand description

Shared formatted-string interpolation parsing.

This module is intentionally syntax-only. It extracts literal and expression segments from f"..." strings so all consumers (compiler, type checker, LSP) can run their normal expression pipelines on the extracted {...} expressions.

Structs§

ContentFormatSpec
Content-string format specification for rich terminal/HTML output.
TableFormatSpec
Typed table rendering configuration for interpolation.

Enums§

AlignSpec
Alignment for content-string rendering.
BorderStyleSpec
Border style for content-string table rendering.
ChartTypeSpec
Chart type hint for content format spec.
ColorSpec
Color specification for content strings.
FormatAlignment
Horizontal alignment for formatted output.
FormatColor
Color hint for formatted output.
InterpolationFormatSpec
Typed format specification for interpolation expressions.
InterpolationPart
A parsed segment of an interpolated string.
NamedContentColor
Named colors for content strings.

Functions§

find_top_level_format_colon
Find the top-level format-separator : in an interpolation expression.
has_interpolation
Check whether a string contains at least one interpolation segment.
has_interpolation_with_mode
Check whether a string contains at least one interpolation segment for the mode.
parse_content_format_spec
Parse a content-string format spec like "fg(red), bold, fixed(2)".
parse_content_interpolation_with_mode
Parse a content string payload into interpolation parts.
parse_interpolation
Parse a formatted string payload into interpolation parts.
parse_interpolation_with_mode
Parse a formatted string payload into interpolation parts using the given mode.
split_expression_and_content_format_spec
Split interpolation content for content strings.
split_expression_and_format_spec
Split interpolation content expr[:spec] at the top-level format separator.