Closed
Description
Documentation
The floating point syntax spec is incorrect, and can be found in /Doc/library/functions.rst:
The syntax rendered currently is the following:
sign ::= "+" | "-"
infinity ::= "Infinity" | "inf"
nan ::= "nan"
digitpart ::= `!digit` (["_"] `!digit`)*
number ::= [digitpart] "." digitpart | digitpart ["."]
exponent ::= ("e" | "E") ["+" | "-"] digitpart
floatnumber ::= number [exponent]
floatvalue ::= [sign] (floatnumber | infinity | nan)
digitpart
should not include an exclamation point or backtick quotes. The backticks appear to be the underlying syntax failing to render, but the exclamation points have a meaning, which is an issue. This is the underlying syntax:
sign: "+" | "-"
infinity: "Infinity" | "inf"
nan: "nan"
digitpart: `!digit` (["_"] `!digit`)*
number: [`digitpart`] "." `digitpart` | `digitpart` ["."]
exponent: ("e" | "E") ["+" | "-"] `digitpart`
floatnumber: number [`exponent`]
EBNF includes a "Special Sequences" syntax, that would be appropriate for this situation, but I'm uncertain if it is possible to use in the underlying YAML format. It should be rendered like this:
sign ::= "+" | "-"
infinity ::= "Infinity" | "inf"
nan ::= "nan"
digit ::= ? Any character in the unicode digit class ?
digitpart ::= digit (["_"] digit)*
number ::= [digitpart] "." digitpart | digitpart ["."]
exponent ::= ("e" | "E") ["+" | "-"] digitpart
floatnumber ::= number [exponent]
floatvalue ::= [sign] (floatnumber | infinity | nan)
Linked PRs
- gh-114070: correct the specification of
digit
in the float() docs #114080 - [3.12] gh-114070: correct the specification of
digit
in the float() docs (GH-114080) #114094 - [3.11] gh-114070: correct the specification of
digit
in the float() docs (GH-114080) #114095 - gh-114070: fix token reference warnings in expressions.rst #114169
- [3.12] gh-114070: fix token reference warnings in expressions.rst (GH-114169) #114192
- [3.11] gh-114070: fix token reference warnings in expressions.rst (GH-114169) #114193