Improve grammar in documentation of format strings

This commit is contained in:
Frank Steffahn 2021-01-01 22:53:34 +01:00
parent 206ee1eea3
commit 2eb4ccd319

View file

@ -282,21 +282,22 @@
//! `%`. The actual grammar for the formatting syntax is: //! `%`. The actual grammar for the formatting syntax is:
//! //!
//! ```text //! ```text
//! format_string := <text> [ maybe-format <text> ] * //! format_string := text [ maybe_format text ] *
//! maybe-format := '{' '{' | '}' '}' | <format> //! maybe_format := '{' '{' | '}' '}' | format
//! format := '{' [ argument ] [ ':' format_spec ] '}' //! format := '{' [ argument ] [ ':' format_spec ] '}'
//! argument := integer | identifier //! argument := integer | identifier
//! //!
//! format_spec := [[fill]align][sign]['#']['0'][width]['.' precision][type] //! format_spec := [[fill]align][sign]['#']['0'][width]['.' precision]type
//! fill := character //! fill := character
//! align := '<' | '^' | '>' //! align := '<' | '^' | '>'
//! sign := '+' | '-' //! sign := '+' | '-'
//! width := count //! width := count
//! precision := count | '*' //! precision := count | '*'
//! type := identifier | '?' | '' //! type := '' | '?' | 'x?' | 'X?' | identifier
//! count := parameter | integer //! count := parameter | integer
//! parameter := argument '$' //! parameter := argument '$'
//! ``` //! ```
//! In the above grammar, `text` may not contain any `'{'` or `'}'` characters.
//! //!
//! # Formatting traits //! # Formatting traits
//! //!