func parseNumber(input []byte) (int, bool) {
	var n int
	s := input
	if len(s) == 0 {
		return 0, false
	}
	if s[0] == '-' {
		s = s[1:]
		n++
		if len(s) == 0 {
			return 0, false
		}
	}
	switch {
	case s[0] == '0':
		s = s[1:]
		n++
	case '1' <= s[0] && s[0] <= '9':
		s = s[1:]
		n++
		for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
			s = s[1:]
			n++
		}
	default:
		return 0, false
	}
	if len(s) >= 2 && s[0] == '.' && '0' <= s[1] && s[1] <= '9' {
		s = s[2:]
		n += 2
		for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
			s = s[1:]
			n++
		}
	}
	if len(s) >= 2 && (s[0] == 'e' || s[0] == 'E') {
		s = s[1:]
		n++
		if s[0] == '+' || s[0] == '-' {
			s = s[1:]
			n++
			if len(s) == 0 {
				return 0, false
			}
		}
		for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
			s = s[1:]
			n++
		}
	}
	if n < len(input) && isNotDelim(input[n]) {
		return 0, false
	}
	return n, true
}
parseNumber reads the given []byte for a valid JSON number. If it is valid,
it returns the number of bytes.  Parsing logic follows the definition in
https://tools.ietf.org/html/rfc7159#section-6, and is based off
encoding/json.isValidNumber function.
package json
import (
	"bytes"
	"strconv"
)