mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/syntax: allow more than one rune "unread"
Make it possible to "unread" more than one byte before the most recently read rune. Use a better name than ungetr2 and make it slightly more efficient. R=Go1.13 Change-Id: I45d5dfa11e508259a972ca6560d1f78d7a51fe15 Reviewed-on: https://go-review.googlesource.com/c/158957 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
701f6a27b5
commit
58365b34bb
2 changed files with 32 additions and 23 deletions
|
|
@ -150,7 +150,7 @@ redo:
|
|||
case '.':
|
||||
c = s.getr()
|
||||
if isDigit(c) {
|
||||
s.ungetr2()
|
||||
s.unread(1)
|
||||
s.number('.')
|
||||
break
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ redo:
|
|||
s.tok = _DotDotDot
|
||||
break
|
||||
}
|
||||
s.ungetr2()
|
||||
s.unread(1)
|
||||
}
|
||||
s.ungetr()
|
||||
s.tok = _Dot
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue