// Scan scans the next token and returns the token.
771935
func (s *Scanner) Scan() token.Token {
	ch := s.next()

	// skip white space
	for isWhitespace(ch) {
		ch = s.next()
	}

	var tok token.Type

	// token text markings
	s.tokStart = s.srcPos.Offset - s.lastCharLen

	// token position, initial next() is moving the offset by one(size of rune
	// actually), though we are interested with the starting point
	s.tokPos.Offset = s.srcPos.Offset - s.lastCharLen
	if s.srcPos.Column > 0 {
		// common case: last character was not a '\n'
		s.tokPos.Line = s.srcPos.Line
		s.tokPos.Column = s.srcPos.Column
	} else {
		// last character was a '\n'
		// (we cannot be at the beginning of the source
		// since we have called next() at least once)
		s.tokPos.Line = s.srcPos.Line - 1
		s.tokPos.Column = s.lastLineLen
	}

	switch {
	case isLetter(ch):
		lit := s.scanIdentifier()
		if lit == "true" || lit == "false" {
			tok = token.BOOL
		} else if lit == "null" {
			tok = token.NULL
		} else {
			s.err("illegal char")
		}
	case isDecimal(ch):
		tok = s.scanNumber(ch)
	default:
		switch ch {
		case eof:
			tok = token.EOF
		case '"':
			tok = token.STRING
			s.scanString()
		case '.':
			tok = token.PERIOD
			ch = s.peek()
			if isDecimal(ch) {
				tok = token.FLOAT
				ch = s.scanMantissa(ch)
				ch = s.scanExponent(ch)
			}
		case '[':
			tok = token.LBRACK
		case ']':
			tok = token.RBRACK
		case '{':
			tok = token.LBRACE
		case '}':
			tok = token.RBRACE
		case ',':
			tok = token.COMMA
		case ':':
			tok = token.COLON
		case '-':
			if isDecimal(s.peek()) {
				ch := s.next()
				tok = s.scanNumber(ch)
			} else {
				s.err("illegal char")
			}
		default:
			s.err("illegal char: " + string(ch))
		}
	}

	// finish token ending
	s.tokEnd = s.srcPos.Offset

	// create token literal
	var tokenText string
	if s.tokStart >= 0 {
		tokenText = string(s.src[s.tokStart:s.tokEnd])
	}
	s.tokStart = s.tokEnd // ensure idempotency of tokenText() call

	return token.Token{
		Type: tok,
		Pos:  s.tokPos,
		Text: tokenText,
	}
}
1118183
func (u *Uint64Slice) Scan(src interface{}) error {
	asBytes, ok := src.([]byte)
	if !ok {
		return errors.New("scan source was not []bytes")
	}
	str := string(asBytes)
	str = str[1 : len(str)-1]
	csvReader := csv.NewReader(strings.NewReader(str))
	slice, err := csvReader.Read()
	if err != nil && err.Error() != "EOF" {
		return err
	}
	var s []uint64
	for _, sl := range slice {
		tmp, err := strconv.ParseUint(sl, 10, 64)
		if err != nil {
			return err
		}
		s = append(s, tmp)
	}
	*u = Uint64Slice(s)
	return nil
}
140021
func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool {
	// Erase the token object.
	*token = yaml_token_t{} // [Go] Is this necessary?

	// No tokens after STREAM-END or error.
	if parser.stream_end_produced || parser.error != yaml_NO_ERROR {
		return true
	}

	// Ensure that the tokens queue contains enough tokens.
	if !parser.token_available {
		if !yaml_parser_fetch_more_tokens(parser) {
			return false
		}
	}

	// Fetch the next token from the queue.
	*token = parser.tokens[parser.tokens_head]
	parser.tokens_head++
	parser.tokens_parsed++
	parser.token_available = false

	if token.typ == yaml_STREAM_END_TOKEN {
		parser.stream_end_produced = true
	}
	return true
}
974698
func (s *Scanner) Scan() bool {
	for s.source.Scan() {
		line := s.source.Text()
		status, fields := s.parseLine(line)
		switch status {
		case qffail:
			continue
		case qfendmultiline:
			s.mlpoped = true
			s.entry = s.qi.qflist[len(s.qi.qflist)-1]
			return true
		case qfignoreline:
			continue
		}
		var lastml *Entry // last multiline entry which isn't poped out
		if !s.mlpoped {
			lastml = s.qi.qflist[len(s.qi.qflist)-1]
		}
		qfl := &Entry{
			Filename: fields.namebuf,
			Lnum:     fields.lnum,
			Col:      fields.col,
			Nr:       fields.enr,
			Pattern:  fields.pattern,
			Text:     fields.errmsg,
			Vcol:     fields.useviscol,
			Valid:    fields.valid,
			Type:     rune(fields.etype),
			Lines:    fields.lines,
		}
		if qfl.Filename == "" && s.qi.currfile != "" {
			qfl.Filename = s.qi.currfile
		}
		s.qi.qflist = append(s.qi.qflist, qfl)
		if s.qi.multiline {
			s.mlpoped = false // mark multiline entry is not poped
			// if there is last multiline entry which isn't poped out yet, pop it out now.
			if lastml != nil {
				s.entry = lastml
				return true
			}
			continue
		}
		// multiline flag doesn't be reset with new entry.
		// %Z or nomach are the only way to reset multiline flag.
		s.entry = qfl
		return true
	}
	// pop last not-ended multiline entry
	if !s.mlpoped {
		s.mlpoped = true
		s.entry = s.qi.qflist[len(s.qi.qflist)-1]
		return true
	}
	return false
}
278589
func (f *Formation) Scan(src interface{}) error {
	bytes, ok := src.([]byte)
	if !ok {
		return error(errors.New("Scan source was not []bytes"))
	}

	formation := make(Formation)
	if err := json.Unmarshal(bytes, &formation); err != nil {
		return err
	}
	*f = formation

	return nil
}
428415
func (ls *LineString) Scan(src interface{}) error {
	b, ok := src.([]byte)
	if !ok {
		return ErrExpectedByteSlice{Value: src}
	}
	got, err := Unmarshal(b)
	if err != nil {
		return err
	}
	ls1, ok := got.(*geom.LineString)
	if !ok {
		return wkbcommon.ErrUnexpectedType{Got: ls1, Want: ls}
	}
	ls.LineString = ls1
	return nil
}
1036742
func (p *PointParser) scan() (Token, string) {
	// If we have a token on the buffer, then return it.
	if p.buf.n != 0 {
		idx := p.buf.n % MAX_BUFFER_SIZE
		tok, lit := p.buf.tok[idx], p.buf.lit[idx]
		p.buf.n -= 1
		return tok, lit
	}

	// Otherwise read the next token from the scanner.
	tok, lit := p.s.Scan()

	// Save it to the buffer in case we unscan later.
	p.buffer(tok, lit)

	return tok, lit
}
287486
func (n *NullBool) Scan(value interface{}) error {
	if value == nil {
		n.Bool, n.Valid = false, false
		return nil
	}
	n.Valid = true
	return convertAssign(&n.Bool, value)
}
1029551
func (u *UUID) Scan(val interface{}) error {
	if s, ok := val.(string); ok {
		return u.SetString(s)
	}
	if b, ok := val.([]byte); ok {
		return u.ReadBytes(b)
	}

	return &ErrInvalidType{reflect.TypeOf(val)}
}
396397
func (s *RevListScanner) scan() ([]byte, string, error) {
	if !s.s.Scan() {
		return nil, "", s.s.Err()
	}

	line := strings.TrimSpace(s.s.Text())
	if len(line) < 40 {
		return nil, "", nil
	}

	sha1, err := hex.DecodeString(line[:40])
	if err != nil {
		return nil, "", err
	}

	var name string
	if len(line) > 40 {
		name = line[41:]
	}

	return sha1, name, nil
}
736198
func (s *Scanner) Scan() (Token, bool) {
	var tok Token

	if !s.eof && s.cur == -1 {
		// move to first rune
		s.read()
	}

	s.skipWhitespace()
	tok.pos = s.cpos

	// the first switch cases all position the scanner on the next rune
	// by their calls to scan*
	switch {
	case s.eof:
		tok.id = eof
	case isLetter(s.cur):
		tok.id = ident
		tok.lit = s.scanIdentifier()
		if _, ok := blacklistedIdents[tok.lit]; ok {
			s.errorpf(tok.pos, "illegal identifier %q", tok.lit)
		}
	case isRuleDefStart(s.cur):
		tok.id = ruledef
		tok.lit = s.scanRuleDef()
	case s.cur == '\'':
		tok.id = char
		tok.lit = s.scanChar()
	case s.cur == '"':
		tok.id = str
		tok.lit = s.scanString()
	case s.cur == '`':
		tok.id = rstr
		tok.lit = s.scanRawString()
	case s.cur == '[':
		tok.id = class
		tok.lit = s.scanClass()
	case s.cur == '{':
		tok.id = code
		tok.lit = s.scanCode()

	default:
		r := s.cur
		s.read()
		switch r {
		case '/':
			if s.cur == '*' || s.cur == '/' {
				tok.id, tok.lit = s.scanComment()
				break
			}
			fallthrough
		case ':', ';', '(', ')', '.', '&', '!', '?', '+', '*', '\n':
			tok.id = tid(r)
			tok.lit = string(r)
		default:
			s.errorf("invalid character %#U", r)
			tok.id = invalid
			tok.lit = string(r)
		}
	}

	return tok, tok.id != eof
}
1007666
func (s *String) Scan(src interface{}) error {
	ss := pq.StringArray(*s)
	err := ss.Scan(src)
	*s = String(ss)
	return err
}
468146
func (dst *pguint32) Scan(src interface{}) error {
	if src == nil {
		*dst = pguint32{Status: Null}
		return nil
	}

	switch src := src.(type) {
	case uint32:
		*dst = pguint32{Uint: src, Status: Present}
		return nil
	case int64:
		*dst = pguint32{Uint: uint32(src), Status: Present}
		return nil
	case string:
		return dst.DecodeText(nil, []byte(src))
	case []byte:
		srcCopy := make([]byte, len(src))
		copy(srcCopy, src)
		return dst.DecodeText(nil, srcCopy)
	}

	return errors.Errorf("cannot scan %T", src)
}
1318176
func (p *Parser) scan() {
	for {
		token, literal := p.l.Lex()
		p.scannedItems = append(p.scannedItems, ScannedItem{token, literal})
		if token == EndOfStringToken {
			break
		}
	}
}
742596
func (e *EUI64) Scan(src interface{}) error {
	b, ok := src.([]byte)
	if !ok {
		return errors.New("lorawan: []byte type expected")
	}
	if len(b) != len(e) {
		return fmt.Errorf("lorawan: []byte must have length %d", len(e))
	}
	copy(e[:], b)
	return nil
}
73087
func (i *Image) Scan(src interface{}) error {
	if src, ok := src.([]byte); ok {
		image, err := Decode(string(src))
		if err != nil {
			return err
		}

		*i = image
	}

	return nil
}
654534
func (s *Scanner) Scan() (r rune) {
	s.tokenIdx = 0
	r, _, err := s.r.ReadRune()
	prevRune := r

	if s.Whitespace.Get(int(r)) {
		s.token[s.tokenIdx] = r
		s.tokenIdx++
		return r
	}

	for ; !s.Whitespace.Get(int(r)); r, _, err = s.r.ReadRune() {
		switch err {
		case nil:
			break
		case io.EOF:
			return EOF
		default:
			s.Error(err)
			return EOF
		}
		s.token[s.tokenIdx] = r
		s.tokenIdx++
		prevRune = r
	}

	// We have to UnreadRune because we went too far of one rune
	err = s.r.UnreadRune()
	if err != nil {
		s.Error(err)
	}

	return prevRune
}