From: Robert Griesemer Date: Thu, 15 Apr 2010 04:33:34 +0000 (-0700) Subject: scanner: implement Peek() to look at the next char w/o advancing X-Git-Tag: weekly.2010-04-27~89 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0fd00c8bb7ae67cc625cf8b2d04efb21f6958648;p=gostls13.git scanner: implement Peek() to look at the next char w/o advancing R=rsc CC=golang-dev https://golang.org/cl/840045 --- diff --git a/src/pkg/scanner/scanner.go b/src/pkg/scanner/scanner.go index 25544f667e..f60a4eed27 100644 --- a/src/pkg/scanner/scanner.go +++ b/src/pkg/scanner/scanner.go @@ -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 {