Golang go/scanner.ErrorHandler type example

package go/scanner

An ErrorHandler may be provided to Scanner.Init. If a syntax error is encountered and a handler was installed, the handler is called with a position and an error message. The position points to the beginning of the offending token.

Golang go/scanner.ErrorHandler type usage example

 func (s *scnr) Init(file *token.File, src []byte, err scanner.ErrorHandler, modeGo bool) {
 s.sc.Init(file, src, err, scanner.ScanComments)
 s.modeGo = modeGo
 s.first = true
 }

Reference :

http://golang.org/pkg/go/scanner/#ErrorHandler

Advertisement