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