MCPcopy
hub / github.com/hashicorp/hcl / scanNumber

Function scanNumber

json/scanner.go:141–158  ·  view source on GitHub ↗
(buf []byte, start pos)

Source from the content-addressed store, hash-verified

139}
140
141func scanNumber(buf []byte, start pos) ([]byte, []byte, pos) {
142 // The scanner doesn't check that the sequence of digit-ish bytes is
143 // in a valid order. The parser must do this when decoding a number
144 // token.
145 var i int
146 p := start
147Byte:
148 for i = 0; i < len(buf); i++ {
149 switch buf[i] {
150 case '-', '+', '.', 'e', 'E', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
151 p.Pos.Byte++
152 p.Pos.Column++
153 default:
154 break Byte
155 }
156 }
157 return buf[:i], buf[i:], p
158}
159
160func byteCanStartKeyword(b byte) bool {
161 switch {

Callers 1

scanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected