Skip to content

Commit

Permalink
simplify offset slicing in parseNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
davecheney committed Nov 2, 2023
1 parent 885b268 commit 535aca9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,10 @@ func (s *Scanner) parseNumber(c byte) int {
// handle the case that the first character is a hyphen
if c == '-' {
offset++
w = w[1:]
}

for {
for _, elem := range w {
for _, elem := range w[offset:] {
switch state {
case begin:
if elem >= '1' && elem <= '9' {
Expand Down Expand Up @@ -256,7 +255,7 @@ func (s *Scanner) parseNumber(c byte) int {
return 0
}
}
w = s.br.window()[offset:]
w = s.br.window()
}
}

Expand Down

0 comments on commit 535aca9

Please sign in to comment.