pub(super) fn lex(
version: FormatDescriptionVersion,
input: &[u8],
) -> Lexed<impl Iterator<Item = Result<Token<'_>, Error>>> ⓘAvailable on (crate features
formatting or parsing) and crate feature alloc only.Expand description
Parse the string into a series of Tokens.
version controls the version of the format description that is being parsed.
- When
versionis 1,[[is the only escape sequence, resulting in a literal[. For the start of a nested format description, a single[is used and is never part of the escape sequence. For example,[optional [[day]]]will lex successfully, ultimately resulting in a component namedoptionalwith the nested componentday. - When
versionis 2 or 3, all escape sequences begin with\. The only characters that may currently follow are\,[, and], all of which result in the literal character. All other characters result in a lex error.