Recursive descent tokenizer and renderer for DayEx format strings.
Parses format strings left-to-right, greedily matching the longest token first.
Handles [escaped] text in square brackets as literals.
Summary
Functions
Format a %DayEx{} struct using the given format string.
Tokenize a format string into a list of {:token, string} or {:literal, string} tuples.
Adjacent literal characters are kept as individual literals (not merged).
Escaped text in [...] is emitted as individual {:literal, content} per character? No —
the spec says merge adjacent literal chars. Looking at test: [Year:] YYYY → [{:literal, "Year:"}, {:literal, " "}, ...].
So the escaped block becomes one literal, and each non-token char outside brackets becomes its own literal.
Functions
Format a %DayEx{} struct using the given format string.
Tokenize a format string into a list of {:token, string} or {:literal, string} tuples.
Adjacent literal characters are kept as individual literals (not merged).
Escaped text in [...] is emitted as individual {:literal, content} per character? No —
the spec says merge adjacent literal chars. Looking at test: [Year:] YYYY → [{:literal, "Year:"}, {:literal, " "}, ...].
So the escaped block becomes one literal, and each non-token char outside brackets becomes its own literal.