parser: Fix missing check for upper exponent (#665)
This commit is contained in:
@@ -968,7 +968,7 @@ byteLoop:
|
||||
func (p *parser) scanIntOrFloat(b []byte) (ast.Reference, []byte, error) {
|
||||
i := 0
|
||||
|
||||
if len(b) > 2 && b[0] == '0' && b[1] != '.' && b[1] != 'e' {
|
||||
if len(b) > 2 && b[0] == '0' && b[1] != '.' && b[1] != 'e' && b[1] != 'E' {
|
||||
var isValidRune validRuneFn
|
||||
|
||||
switch b[1] {
|
||||
|
||||
@@ -155,6 +155,11 @@ func TestUnmarshal_Floats(t *testing.T) {
|
||||
input: `0e0`,
|
||||
expected: 0.0,
|
||||
},
|
||||
{
|
||||
desc: "float upper exponent zero",
|
||||
input: `0E0`,
|
||||
expected: 0.0,
|
||||
},
|
||||
{
|
||||
desc: "float fractional with exponent",
|
||||
input: `6.626e-34`,
|
||||
|
||||
Reference in New Issue
Block a user