diff --git a/doc/syntax.md b/doc/syntax.md index b70cf383..a06b8c3e 100644 --- a/doc/syntax.md +++ b/doc/syntax.md @@ -12,7 +12,8 @@ The grammar for a replacement field is as follows:
-replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}" +replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}" arg_id ::= integer | identifier integer ::= digit+ digit ::= "0"..."9" @@ -77,8 +78,10 @@ format_spec ::= [[fill]align][sign]["#"]["0"][width]["." precision]["L"][type] fill ::= <a character other than '{' or '}'> align ::= "<" | ">" | "^" sign ::= "+" | "-" | " " -width ::= integer | "{" [arg_id] "}" -precision ::= integer | "{" [arg_id] "}" +width ::= integer | "{" [arg_id] "}" +precision ::= integer | "{" [arg_id] "}" type ::= "a" | "A" | "b" | "B" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "o" | "p" | "s" | "x" | "X" | "?"@@ -92,13 +95,10 @@ the fill character and the alignment option are absent. The meaning of the various alignment options is as follows:
Option | Meaning | ||
---|---|---|---|
'<' |
@@ -117,7 +117,6 @@ The meaning of the various alignment options is as follows: | '^' |
Forces the field to be centered within the available space. |
Option | +Meaning | +||||
---|---|---|---|---|---|
'+' |
+ + Indicates that a sign should be used for both nonnegative as well as + negative numbers. + | +'-' |
+ + Indicates that a sign should be used only for negative numbers (this is the + default behavior). + | +space | ++ Indicates that a leading space should be used on nonnegative numbers, and a + minus sign on negative numbers. + | +
Type | +Meaning | +
---|---|
'b' |
+
+ Binary format. Outputs the number in base 2. Using the '#'
+ option with this type adds the prefix "0b" to the output value.
+ |
+
'B' |
+
+ Binary format. Outputs the number in base 2. Using the '#'
+ option with this type adds the prefix "0B" to the output value.
+ |
+
'c' |
+ Character format. Outputs the number as a character. | +
'd' |
+ Decimal integer. Outputs the number in base 10. | +
'o' |
+ Octal format. Outputs the number in base 8. | +
'x' |
+
+ Hex format. Outputs the number in base 16, using lower-case letters for the
+ digits above 9. Using the '#' option with this type adds the
+ prefix "0x" to the output value.
+ |
+
'X' |
+
+ Hex format. Outputs the number in base 16, using upper-case letters for the
+ digits above 9. Using the '#' option with this type adds the
+ prefix "0X" to the output value.
+ |
+
none | +The same as 'd' . |
+
Type | -Meaning | +
---|
Type | +Meaning |
---|---|
'a' |
-Hexadecimal floating point format. Prints the number in base 16 with
-prefix "0x" and lower-case letters for digits above 9. Uses
-'p' to indicate the exponent. |
+
'a' |
+
+ Hexadecimal floating point format. Prints the number in base 16 with
+ prefix "0x" and lower-case letters for digits above 9.
+ Uses 'p' to indicate the exponent.
+ |
'A' |
-Same as 'a' except it uses upper-case letters for the
-prefix, digits above 9 and to indicate the exponent. |
+
'A' |
+
+ Same as 'a' except it uses upper-case letters for the
+ prefix, digits above 9 and to indicate the exponent.
+ |
'e' |
-Exponent notation. Prints the number in scientific notation using -the letter 'e' to indicate the exponent. | +
'e' |
+ + Exponent notation. Prints the number in scientific notation using + the letter 'e' to indicate the exponent. + |
'E' |
-Exponent notation. Same as 'e' except it uses an
-upper-case 'E' as the separator character. |
+
'E' |
+
+ Exponent notation. Same as 'e' except it uses an
+ upper-case 'E' as the separator character.
+ |
'f' |
-Fixed point. Displays the number as a fixed-point number. | +
'f' |
+ Fixed point. Displays the number as a fixed-point number. |
'F' |
-Fixed point. Same as 'f' , but converts nan
-to NAN and inf to INF . |
+
'F' |
+
+ Fixed point. Same as 'f' , but converts nan
+ to NAN and inf to INF .
+ |
'g' |
-General format. For a given precision A precision of |
+
'g' |
+
+ General format. For a given precision A precision of |
'G' |
-General format. Same as 'g' except switches to
-'E' if the number gets too large. The representations of
-infinity and NaN are uppercased, too. |
+
'G' |
+
+ General format. Same as 'g' except switches to
+ 'E' if the number gets too large. The representations of
+ infinity and NaN are uppercased, too.
+ |
none | -Similar to 'g' , except that the default precision is as
-high as needed to represent the particular value. |
+
none | +
+ Similar to 'g' , except that the default precision is as
+ high as needed to represent the particular value.
+ |
-chrono_format_spec ::= [[fill]align][width]["." precision][chrono_specs] +chrono_format_spec ::= [[fill]align][width]["." precision][chrono_specs] chrono_specs ::= [chrono_specs] conversion_spec | chrono_specs literal_char conversion_spec ::= "%" [padding_modifier] [locale_modifier] chrono_type literal_char ::= <a character other than '{', '}' or '%'> @@ -359,8 +428,8 @@ The available padding modifiers (*padding_modifier*) are: | `'_'` | Do not pad a numeric result string. | | `'0'` | Pad a numeric result string with zeros. | -Currently, these modifiers are only supported for the ``'H', 'I', 'M', 'S', 'U', 'V'`` -and ``'W'`` presentation types. +Currently, these modifiers are only supported for the `'H'`, `'I'`, `'M'`, +`'S'`, `'U'`, `'V'` and `'W'` presentation types. ## Range Format Specifications