goprotobuf: Text parsing compatibility fixes:
        - accept semicolon and comma after fields
	- accept "inf" and "-inf" for float fields

R=iant
CC=golang-dev
https://codereview.appspot.com/6885045
diff --git a/proto/text_parser.go b/proto/text_parser.go
index 3c79876..b4e4bc1 100644
--- a/proto/text_parser.go
+++ b/proto/text_parser.go
@@ -154,7 +154,7 @@
 	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 @@
 				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 @@
 		}
 	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 {