// NextScanner provides the next scanner assuming that each scanner
// represents different file, and multiple files for single source
14689
func (m *FilePager) NextScanner() (schema.ConnScanner, error) {

	fr, err := m.NextFile()
	if err == iterator.Done {
		return nil, err
	} else if err != nil {
		u.Warnf("NextFile Error %v", err)
		return nil, err
	}

	scanner, err := m.fs.fh.Scanner(m.fs.store, fr)
	if err != nil {
		u.Errorf("Could not open file scanner %v err=%v", m.fs.fileType, err)
		return nil, err
	}
	m.ConnScanner = scanner
	return scanner, err
}
7736
func separatorsScanner(separators []rune) func(data []byte, atEOF bool) (int, []byte, error) {
	return func(data []byte, atEOF bool) (advance int, token []byte, err error) {
		if atEOF && len(data) == 0 {
			return 0, nil, nil
		}

		// Transform the separators into a map (for efficient lookup)
		seps := make(map[rune]bool)
		for _, r := range separators {
			seps[r] = true
		}

		// Scan until separator, marking the end of a token
		for width, i := 0, 0; i < len(data); i += width {
			var r rune
			r, width = utf8.DecodeRune(data[i:])
			if seps[r] {
				if i == 0 {
					// Separator token
					return i + width, data[0 : i+width], nil
				}

				// Normal token
				return i, data[0:i], nil
			}
		}

		// If we're at EOF, we have a final, non-empty, non-terminated token: return it
		if atEOF && len(data) > 0 {
			return len(data), data[0:], nil
		}

		// Request more data
		return 0, nil, nil
	}
}
1189744
func (s *GitScanner) ScanAll(cb GitScannerFoundPointer) error {
	callback, err := firstGitScannerCallback(cb, s.FoundPointer)
	if err != nil {
		return err
	}

	opts := s.opts(ScanAllMode)
	opts.SkipDeletedBlobs = false
	return scanLeftRightToChan(s, callback, "", "", opts)
}
1142885
func (r *Reader) Next(n int) []byte {
	oldI := r.i
	r.i += n
	return r.s[oldI:r.i]
}
1020112
func NewScannerString(s string) *Scanner {
	sc := Scanner{in: bufio.NewReader(strings.NewReader(s))}
	return &sc
}
883839
func scanFiles(paths chan string) {
	walker := func(path string, info os.FileInfo, err error) error {
		log.Infof("Found %s", path)
		if err != nil {
			return err
		}

		if info.Mode().IsRegular() {
			paths <- path
		}
		return nil
	}

	for _, path := range flag.Args() {
		err := filepath.Walk(path, walker)
		if err != nil {
			log.Errorf("Walk failed: %v", err)
		}
	}
	close(paths)
}
907801
func (s *byteScanner) nextChar() error {
	//println("--- nextChar(). Offset / len(s.buf): ", s.pos.Offset, len(s.buf))

	if s.pos.Offset >= len(s.buf) {
		s.ch = -1
		return io.EOF
	}
	s.pos.Column++
	if s.ch == '\n' {
		s.pos.Line++
		s.pos.Column = 1
	}
	r, w := rune(s.buf[s.pos.Offset]), 1
	if r >= 0x80 {
		r, w = utf8.DecodeRune(s.buf[s.pos.Offset:])
		if r == utf8.RuneError && w == 1 {
			s.error(s.pos, "illegal UTF-8 encoding")
		}
	}
	s.pos.Column++
	s.pos.Offset += w
	s.ch = r
	return nil
}
1365922
func (m *FilePager) NextFile() (*FileReader, error) {

	select {
	case <-m.exit:
		// See if exit was called
		return nil, iterator.Done
	case fr := <-m.readers:
		if fr == nil {
			return nil, iterator.Done
		}
		return fr, nil
	}
}
431720
func (m *FileChangeListIterator) Next() (item Change, err error) {
	if m.index >= len(m.collection) {
		return nil, IteratorBoundsError(m.index)
	}
	f := m.collection[m.index]
	m.index++
	item, err = unmarshalFile(m.dirname, f)
	return
}
631482
func (l *Scanner) Next() bool {
	c, ok := l.nextChar()
	if !ok {
		return false
	}
	switch c {
	case '"': // quoted-string;
		return l.fetchQuotedString()

	case '(': // comment;
		return l.fetchComment()

	case '\\', ')': // unexpected chars;
		l.err = true
		return false

	default:
		return l.fetchToken()
	}
}
1230473
func NewScannerReader(src io.Reader) *scanner.Scanner {
	var s scanner.Scanner
	s.Init(src)
	s.Error = func(_ *scanner.Scanner, _ string) {}
	s.Whitespace = 0
	s.Mode = s.Mode ^ scanner.SkipComments
	return &s
}
266596
func (ri *readerOffsetsIterator) Next() bool {
	if ri.i >= len(ri.r.offsets) {
		return false
	} else if ri.first {
		ri.first = false
		return true
	}

	ri.i++
	ri.ks = rOIKeyState{}

	for ri.pi < len(ri.r.prefixes) && ri.i >= ri.r.prefixes[ri.pi].total {
		ri.pi++
	}

	return ri.i < len(ri.r.offsets)
}
195602
func (d *OneToOne) Next() []byte {
	data := d.d.Next()
	return *(*[]byte)(data)
}
152145
func (errorformat *Errorformat) NewScanner(r io.Reader) *Scanner {
	return &Scanner{
		Errorformat: errorformat,
		source:      bufio.NewScanner(r),
		qi:          &qfinfo{},
		mlpoped:     true,
	}
}
79829
func (l *lexer) next() rune {
	if int(l.pos) >= len(l.input) {
		return eof
	}
	r := l.input[l.pos]
	l.pos++
	return r
}
74307
func (s *Scanner) scanNumber(ch rune) token.Type {
	zero := ch == '0'
	pos := s.srcPos

	s.scanMantissa(ch)
	ch = s.next() // seek forward
	if ch == 'e' || ch == 'E' {
		ch = s.scanExponent(ch)
		return token.FLOAT
	}

	if ch == '.' {
		ch = s.scanFraction(ch)
		if ch == 'e' || ch == 'E' {
			ch = s.next()
			ch = s.scanExponent(ch)
		}
		return token.FLOAT
	}

	if ch != eof {
		s.unread()
	}

	// If we have a larger number and this is zero, error
	if zero && pos != s.srcPos {
		s.err("numbers cannot start with 0")
	}

	return token.NUMBER
}
333570
func newLogScanner(dir LogDiffDirection, r io.Reader) *logScanner {
	return &logScanner{
		s:                   bufio.NewScanner(r),
		dir:                 dir,
		pointerData:         &bytes.Buffer{},
		currentFileIncluded: true,

		// no need to compile these regexes on every `git-lfs` call, just ones that
		// use the scanner.
		commitHeaderRegex:    regexp.MustCompile(`^lfs-commit-sha: ([A-Fa-f0-9]{40})(?: ([A-Fa-f0-9]{40}))*`),
		fileHeaderRegex:      regexp.MustCompile(`diff --git a\/(.+?)\s+b\/(.+)`),
		fileMergeHeaderRegex: regexp.MustCompile(`diff --cc (.+)`),
		pointerDataRegex:     regexp.MustCompile(`^([\+\- ])(version https://git-lfs|oid sha256|size|ext-).*$`),
	}
}