Currency Module User’s Guide : Chapter 9 Technical Notes : Input Format Grammar
Input Format Grammar
This section describes the grammar required by the RWDecimal<T> stream input and string construction routines. The grammar provides a flexible and well-defined format for describing input.
For most users, the input format can be described as a one that lets you write any number in the conventional manner. For this discussion, "the conventional manner" allows commas as digit group separators, and permits leading dollar signs. It also allows you to indicate a negative number by appending a leading minus sign or surrounding the number with a pair of parentheses.
Here is the grammar:
 
digit ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
whitespace ::= " " | "\t" | "\r" | "\n"
 
decimal-point ::= <locale-specific-decimal-point>
thousands-sep ::= <locale-specific-thousands-separator>
 
special-sentinel ::= "missing" | "null" | "NaN"
 
thousands-sep-digits ::= digit (thousands-sep? thousands-sep-digits)*
 
decimal ::= thousands-sep-digits decimal-point?
::= thousands-sep-digits? decimal-point digit+
 
signed-decimal ::= ("+" | "-")? whitespace* decimal
 
value ::= "(" special-sentinel ")"
::= "(" whitespace* decimal whitespace* %? whitespace* ")"
::= signed-decimal whitespace* %?
::= "$"? signed-decimal
::= "$"? "(" whitespace* decimal whitespace* ")"
 
ws-delimited-value ::= whitespace* value whitespace*