Skip to content

Commit f5468ad

Browse files
committed
Use a production list
1 parent 5cbf217 commit f5468ad

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

Doc/library/decimal.rst

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -350,18 +350,19 @@ Decimal objects
350350
*value* can be an integer, string, tuple, :class:`float`, or another :class:`Decimal`
351351
object. If no *value* is given, returns ``Decimal('0')``. If *value* is a
352352
string, it should conform to the decimal numeric string syntax after leading
353-
and trailing whitespace characters are removed::
354-
355-
sign ::= '+' | '-'
356-
digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
357-
indicator ::= 'e' | 'E'
358-
digits ::= (digit | '_')* digit (digit | '_')*
359-
decimal-part ::= digits '.' [digits] | ['.'] digits
360-
exponent-part ::= indicator [sign] digits
361-
infinity ::= 'Infinity' | 'Inf'
362-
nan ::= 'NaN' [digits] | 'sNaN' [digits]
363-
numeric-value ::= decimal-part [exponent-part] | infinity
364-
numeric-string ::= [sign] numeric-value | [sign] nan
353+
and trailing whitespace characters are removed:
354+
355+
.. productionlist:: decimal
356+
sign: "+" | "-"
357+
digit: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
358+
indicator: "e" | "E"
359+
digits: (`digit` | "_")* `digit` (`digit` | "_")*
360+
decimalpart: `digits` "." [`digits`] | ["."] `digits`
361+
exponentpart: indicator [sign] digits
362+
infinity: "Infinity" | "Inf"
363+
nan: "NaN" [`digits`] | "sNaN" [`digits`]
364+
numericvalue: `decimalpart` [`exponentpart`] | `infinity`
365+
numericstring: [`sign`] `numericvalue` | [`sign`] `nan`
365366

366367
Other Unicode decimal digits are also permitted where ``digit``
367368
appears above. These include decimal digits from various other

0 commit comments

Comments
 (0)