]> Cypherpunks repositories - gostls13.git/commitdiff
json: handle capital floating point exponent (1E100).
authorPieter Droogendijk <pieter@binky.org.uk>
Mon, 24 Jan 2011 08:10:50 +0000 (18:10 +1000)
committerAndrew Gerrand <adg@golang.org>
Mon, 24 Jan 2011 08:10:50 +0000 (18:10 +1000)
When parsing numbers with an exponent (like "12e-1"), the JSON scanner
would only allow a lowercase 'e', while the RFC also allows the
uppercase 'E'.

R=adg
CC=golang-dev, rsc
https://golang.org/cl/3986042

src/pkg/json/scanner.go

index 112c8f9c3507a32cfe79eac6759dbb487f90caaa..e98ddef5cc15a4fe9dd2e7b3cb616b4b8d14c8c5 100644 (file)
@@ -416,7 +416,7 @@ func state0(s *scanner, c int) int {
                s.step = stateDot
                return scanContinue
        }
-       if c == 'e' {
+       if c == 'e' || c == 'E' {
                s.step = stateE
                return scanContinue
        }
@@ -440,7 +440,7 @@ func stateDot0(s *scanner, c int) int {
                s.step = stateDot0
                return scanContinue
        }
-       if c == 'e' {
+       if c == 'e' || c == 'E' {
                s.step = stateE
                return scanContinue
        }