Commit 0fd00c8b authored by Robert Griesemer's avatar Robert Griesemer

scanner: implement Peek() to look at the next char w/o advancing

R=rsc
CC=golang-dev
https://golang.org/cl/840045
parent 1baf35e4
......@@ -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) {
s.ErrorCount++
if s.Error != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment