(raw builtinJSON.Number)
| 142 | } |
| 143 | |
| 144 | func parseJSONNumber(raw builtinJSON.Number) (value interface{}, err error) { |
| 145 | if strings.Contains(raw.String(), ".") { |
| 146 | // float64 |
| 147 | value, err = raw.Float64() |
| 148 | } else { |
| 149 | // int64 |
| 150 | value, err = raw.Int64() |
| 151 | } |
| 152 | if err != nil { |
| 153 | return nil, errors.Wrap(code.ParseError, |
| 154 | fmt.Sprintf("parse json number failed: %v", err)) |
| 155 | } |
| 156 | return value, nil |
| 157 | } |
| 158 | |
| 159 | const ( |
| 160 | regexVariable = `[a-zA-Z_]\w*` // variable name should start with a letter or underscore |
no test coverage detected