test(number): cover zero-prefixable exponent digits

Assisted-by: GLM 5.3
This commit is contained in:
2026-09-17 23:05:27 +02:00
parent 830f840f44
commit 3c1f65038b
2 changed files with 7 additions and 1 deletions
+3 -1
View File
@@ -104,7 +104,9 @@ func decodeFloat(tok string) (any, error) {
build += "." + fp
}
// The ABNF requires at least one digit after the exponent marker, so a
// trailing e or E is an error even though strconv would accept it.
// trailing e or E is an error even though strconv would accept it. The
// digits are a zero-prefixable integer, so leading zeros are fine here
// (the corpus holds valid cases such as 1e06 and 0e00).
if hasExp {
esign, edigits := splitSign(exp)
ed, err := joinDigits(edigits, isDecDigit)