Source File
decode_token.go
Belonging Package
google.golang.org/protobuf/internal/encoding/text
package text
import (
)
const (
Invalid Kind = iota
EOF
Name // Name indicates the field name.
Scalar // Scalar are scalar values, e.g. "string", 47, ENUM_LITERAL, true.
MessageOpen
MessageClose
ListOpen
ListClose
bof = Invalid
)
func ( Kind) () string {
switch {
case Invalid:
return "<invalid>"
case EOF:
return "eof"
case Scalar:
return "scalar"
case Name:
return "name"
case MessageOpen:
return "{"
case MessageClose:
return "}"
case ListOpen:
return "["
case ListClose:
return "]"
case comma:
return ","
case semicolon:
return ";"
default:
return fmt.Sprintf("<invalid:%v>", uint8())
}
}
const hasSeparator = 1 << 7
const (
numberValue = iota + 1
stringValue
literalValue
)
const isNegative = 1 << 7
func ( Token) () (float64, bool) {
if .kind != Scalar {
return 0, false
}
switch .attrs {
case literalValue:
if , := floatLits[strings.ToLower(string(.raw))]; {
return , true
}
case numberValue:
, := strconv.ParseFloat(.str, 64)
if == nil {
return , true
}
:= .(*strconv.NumError)
if .Err == strconv.ErrRange {
return , true
}
}
return 0, false
}
![]() |
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. |