Documentation
¶
Index ¶
- Variables
- func TokenEquals(x, y Token) bool
- func UnmarshalI32(s string) (int32, bool)
- func UnmarshalString(s string) (string, error)
- type Decoder
- type Kind
- type NameKind
- type Token
- func (t Token) Bool() (bool, bool)
- func (t Token) Enum() (string, bool)
- func (t Token) FieldNumber() int32
- func (t Token) Float32() (float32, bool)
- func (t Token) Float64() (float64, bool)
- func (t Token) HasSeparator() bool
- func (t Token) IdentName() string
- func (t Token) Int32() (int32, bool)
- func (t Token) Int64() (int64, bool)
- func (t Token) Kind() Kind
- func (t Token) NameKind() NameKind
- func (t Token) Pos() int
- func (t Token) RawString() string
- func (t Token) String() (string, bool)
- func (t Token) TypeName() string
- func (t Token) Uint32() (uint32, bool)
- func (t Token) Uint64() (uint64, bool)
Constants ¶
This section is empty.
Variables ¶
var ErrUnexpectedEOF = fmt.Errorf("%w", io.ErrUnexpectedEOF)
ErrUnexpectedEOF means that EOF was encountered in the middle of the input.
Functions ¶
func TokenEquals ¶
TokenEquals returns true if given Tokens are equal, else false.
func UnmarshalI32 ¶
UnmarshalI32 returns an i32 number forr given a textproto intlit value.
func UnmarshalString ¶
UnmarshalString returns an unescaped string given a textproto string value. String value needs to contain single or double quotes. This is only used by internal/encoding/defval package for unmarshaling bytes.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder is a token-based textproto decoder.
func NewDecoder ¶
NewDecoder returns a Decoder to read the given []byte.
func (*Decoder) Peek ¶
Peek looks ahead and returns the next token and error without advancing a read.
type Kind ¶
type Kind uint8
Kind represents a token kind expressible in the textproto format.
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
Token provides a parsed token kind and value. Values are provided by the different accessor methods.
func (Token) FieldNumber ¶
FieldNumber returns the value for FieldNumber type. It returns a non-negative int32 value. Caller will still need to validate for the correct field number range.
func (Token) HasSeparator ¶
HasSeparator returns true if the field name is followed by the separator char ':', else false. It panics if type is not Name.
func (Token) NameKind ¶
NameKind returns IdentName, TypeName or FieldNumber. It panics if type is not Name.