docs: grammar documenation updated

This commit is contained in:
Mateusz Pusz
2023-12-27 11:27:18 +01:00
parent b75cf85014
commit 265cabb0e5

View File

@@ -31,20 +31,33 @@
// Grammar // Grammar
// //
// units-format-spec ::= [fill-and-align] [width] [units-specs] // quantity-format-spec ::= [fill-and-align] [width] [quantity-specs]
// units-specs ::= conversion-spec // quantity-specs ::= conversion-spec
// units-specs conversion-spec // quantity-specs conversion-spec
// units-specs literal-char // quantity-specs literal-char
// literal-char ::= any character other than '{' or '}' // literal-char ::= any character other than '{' or '}'
// conversion-spec ::= '%' units-type // conversion-spec ::= '%' type
// units-type ::= [units-rep-modifier] 'Q' // type ::= [rep-modifier] 'Q'
// [units-unit-modifier] 'q' // [unit-modifier] 'q'
// units-rep-modifier ::= [sign] [#] [precision] [L] [units-rep-type] // rep-modifier ::= [sign] [#] [precision] [L] [rep-type]
// units-rep-type ::= one of "aAbBdeEfFgGoxX" // rep-type ::= one of
// units-unit-modifier ::= [units-text-encoding, units-unit-symbol-denominator, units-unit-symbol-separator] // a A b B d e E f F g G o x X
// units-text-encoding ::= one of "UA" // unit-modifier ::= [text-encoding] [unit-symbol-solidus] [unit-symbol-separator]
// units-unit-symbol-solidus ::= one of "oan" // [text-encoding] [unit-symbol-separator] [unit-symbol-solidus]
// units-unit-symbol-separator ::= one of "sd" // [unit-symbol-solidus] [text-encoding] [unit-symbol-separator]
// [unit-symbol-solidus] [unit-symbol-separator] [text-encoding]
// [unit-symbol-separator] [text-encoding] [unit-symbol-solidus]
// [unit-symbol-separator] [unit-symbol-solidus] [text-encoding]
// text-encoding ::= one of
// U A
// unit-symbol-solidus ::= one of
// o a n
// unit-symbol-separator ::= one of
// s d
// TODO Should the below be allowed? Is it even possible to implement with `format()` being const?
// std::cout << std::format("{:%Q %q %Q %q}\n", 123s);
namespace mp_units::detail { namespace mp_units::detail {