Source File
decode_number.go
Belonging Package
google.golang.org/protobuf/internal/encoding/text
package text
func ( *Decoder) () (Token, bool) {
:= .in
:= parseNumber()
if .size == 0 {
return Token{}, false
}
:= .kind
if .neg {
|= isNegative
}
:= .size
:= .size - 1
if .kind == numFloat && (.in[] == 'f' || .in[] == 'F') {
=
}
:= Token{
kind: Scalar,
attrs: numberValue,
pos: len(.orig) - len(.in),
raw: .in[:.size],
str: string(.in[:]),
numAttrs: ,
}
.consume(.size)
return , true
}
const (
numDec uint8 = (1 << iota) / 2
numHex
numOct
numFloat
)
switch {
case [0] == '0':
if len() > 1 {
switch {
= numOct
:= 2
= [2:]
for len() > 0 && '0' <= [0] && [0] <= '7' {
= [1:]
++
}
+=
}
if &(numHex|numOct) > 0 {
if len() > 0 && !isDelim([0]) {
return number{}
}
return number{kind: , neg: , size: }
}
}
= [1:]
++
case '1' <= [0] && [0] <= '9':
:= 1
= [1:]
for len() > 0 && '0' <= [0] && [0] <= '9' {
= [1:]
++
}
+=
if len() > 0 && [0] == '.' {
:= 1
![]() |
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. |