|
|
@@ -154,7 +154,7 @@ func (p *textParser) advance() {
|
|
|
p.cur.offset, p.cur.line = p.offset, p.line
|
|
|
p.cur.unquoted = ""
|
|
|
switch p.s[0] {
|
|
|
- case '<', '>', '{', '}', ':', '[', ']':
|
|
|
+ case '<', '>', '{', '}', ':', '[', ']', ';', ',':
|
|
|
// Single symbol
|
|
|
p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)]
|
|
|
case '"', '\'':
|
|
|
@@ -525,6 +525,15 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) *ParseError
|
|
|
reqCount--
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // For backward compatibility, permit a semicolon or comma after a field.
|
|
|
+ tok = p.next()
|
|
|
+ if tok.err != nil {
|
|
|
+ return tok.err
|
|
|
+ }
|
|
|
+ if tok.value != ";" && tok.value != "," {
|
|
|
+ p.back()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if reqCount > 0 {
|
|
|
@@ -581,8 +590,9 @@ func (p *textParser) readAny(v reflect.Value, props *Properties) *ParseError {
|
|
|
}
|
|
|
case reflect.Float32, reflect.Float64:
|
|
|
v := tok.value
|
|
|
- if strings.HasSuffix(v, "f") {
|
|
|
- // Ignore 'f' for compatibility with output generated by C++.
|
|
|
+ // Ignore 'f' for compatibility with output generated by C++, but don't
|
|
|
+ // remove 'f' when the value is "-inf" or "inf".
|
|
|
+ if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" {
|
|
|
v = v[:len(v)-1]
|
|
|
}
|
|
|
if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil {
|