Source File
decode_token.go
Belonging Package
google.golang.org/protobuf/internal/encoding/json
package json
import (
)
type Kind uint16
const (
Invalid Kind = (1 << iota) / 2
EOF
Null
Bool
Number
String
Name
ObjectOpen
ObjectClose
ArrayOpen
ArrayClose
comma
)
func ( Kind) () string {
switch {
case EOF:
return "eof"
case Null:
return "null"
case Bool:
return "bool"
case Number:
return "number"
case String:
return "string"
case ObjectOpen:
return "{"
case ObjectClose:
return "}"
case Name:
return "name"
case ArrayOpen:
return "["
case ArrayClose:
return "]"
case comma:
return ","
}
return "<invalid>"
}
func ( Token) ( int) (uint64, bool) {
, := .getIntStr()
if ! {
return 0, false
}
, := strconv.ParseUint(, 10, )
if != nil {
return 0, false
}
return , true
}
func ( Token) () (string, bool) {
if .kind != Number {
return "", false
}
, := parseNumberParts(.raw)
if ! {
return "", false
}
return normalizeToIntString()
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |