type source … const sentinel … func (s *source) init(in io.Reader, errh func(line, col uint, msg string)) { … } const linebase … const colbase … // pos returns the (line, col) source position of s.ch. func (s *source) pos() (line, col uint) { … } // error reports the error msg at source position s.pos(). func (s *source) error(msg string) { … } // start starts a new active source segment (including s.ch). // As long as stop has not been called, the active segment's // bytes (excluding s.ch) may be retrieved by calling segment. func (s *source) start() { … } func (s *source) stop() { … } func (s *source) segment() []byte { … } // rewind rewinds the scanner's read position and character s.ch // to the start of the currently active segment, which must not // contain any newlines (otherwise position information will be // incorrect). Currently, rewind is only needed for handling the // source sequence ".."; it must not be called outside an active // segment. func (s *source) rewind() { … } func (s *source) nextch() { … } // fill reads more source bytes into s.buf. // It returns with at least one more byte in the buffer, or with s.ioerr != nil. func (s *source) fill() { … } // nextSize returns the next bigger size for a buffer of a given size. func nextSize(size int) int { … }