code: func (s *bufScanner) scanFunc(scan func() (Token, Pos, string)) (tok Token, pos Pos, lit string) {
  	// If we have unread tokens then read them off the buffer first.
  	if s.n > 0 {
  		s.n--
  		return s.curr()
  	}
  
  	// Move buffer position forward and save the token.
  	s.i = (s.i + 1) % len(s.buf)
  	buf := &s.buf[s.i]
  	buf.tok, buf.pos, buf.lit = scan()
  
  	return s.curr()
  }
docs: // scanFunc uses the provided function to scan the next token.