khenaidoo | d948f77 | 2021-08-11 17:49:24 -0400 | [diff] [blame] | 1 | // Copyright 2018 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // Package text implements the text format for protocol buffers. |
| 6 | // This package has no semantic understanding for protocol buffers and is only |
| 7 | // a parser and composer for the format. |
| 8 | // |
| 9 | // There is no formal specification for the protobuf text format, as such the |
| 10 | // C++ implementation (see google::protobuf::TextFormat) is the reference |
| 11 | // implementation of the text format. |
| 12 | // |
| 13 | // This package is neither a superset nor a subset of the C++ implementation. |
| 14 | // This implementation permits a more liberal grammar in some cases to be |
| 15 | // backwards compatible with the historical Go implementation. |
| 16 | // Future parsings unique to Go should not be added. |
| 17 | // Some grammars allowed by the C++ implementation are deliberately |
| 18 | // not implemented here because they are considered a bug by the protobuf team |
| 19 | // and should not be replicated. |
| 20 | // |
| 21 | // The Go implementation should implement a sufficient amount of the C++ |
| 22 | // grammar such that the default text serialization by C++ can be parsed by Go. |
| 23 | // However, just because the C++ parser accepts some input does not mean that |
| 24 | // the Go implementation should as well. |
| 25 | // |
| 26 | // The text format is almost a superset of JSON except: |
| 27 | // * message keys are not quoted strings, but identifiers |
| 28 | // * the top-level value must be a message without the delimiters |
| 29 | package text |