go-json/decode_context.go

22 lines
306 B
Go
Raw Normal View History

2020-04-23 19:39:20 +03:00
package json
var (
isWhiteSpace = [256]bool{}
)
func init() {
isWhiteSpace[' '] = true
isWhiteSpace['\n'] = true
isWhiteSpace['\t'] = true
isWhiteSpace['\r'] = true
}
2020-05-06 20:37:29 +03:00
func skipWhiteSpace(buf []byte, cursor int) int {
2020-05-07 07:44:41 +03:00
LOOP:
if isWhiteSpace[buf[cursor]] {
cursor++
goto LOOP
2020-04-23 19:39:20 +03:00
}
2020-05-07 07:44:41 +03:00
return cursor
2020-04-23 19:39:20 +03:00
}