mirror of
https://github.com/golang/go
synced 2024-11-25 09:27:57 -07:00
scanner: implement Peek() to look at the next char w/o advancing
R=rsc CC=golang-dev https://golang.org/cl/840045
This commit is contained in:
parent
1baf35e41f
commit
0fd00c8bb7
@ -282,6 +282,14 @@ func (s *Scanner) Next() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Peek returns the next Unicode character in the source without advancing
|
||||||
|
// the scanner. It returns EOF if the scanner's position is at the last
|
||||||
|
// character of the source.
|
||||||
|
func (s *Scanner) Peek() int {
|
||||||
|
return s.ch
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func (s *Scanner) error(msg string) {
|
func (s *Scanner) error(msg string) {
|
||||||
s.ErrorCount++
|
s.ErrorCount++
|
||||||
if s.Error != nil {
|
if s.Error != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user