Documentation
¶
Overview ¶
Package fmtspec provides a tiny shared parser for the subset of C printf format specifiers that Trice needs during source analysis and host-side decoding.
The parser exists to keep internal/id and internal/decoder in sync. Issue #649 showed that the previous duplicated regex-based scanners drifted apart and did not recognize valid C length modifiers such as %zu, %lu, %lX or %llX.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Kind ¶
type Kind int
Kind classifies a single format specifier for later decoder-side handling.
type Spec ¶
Spec describes one parsed and normalized format specifier.
func Normalize ¶
Normalize rewrites valid C length-modified format specifiers to a length-free form that Go fmt understands while preserving flags, width and precision.
Examples:
%zu -> %u %8lu -> %8u %li -> %d %016llX -> %016X %04Lf -> %04f
Unsupported or invalid combinations are intentionally left untouched and are not counted as recognized Trice format specifiers.