// curr returns the last read character and position.
494142
func (r *reader) curr() (ch rune, pos Pos) {
	i := (r.i - r.n + len(r.buf)) % len(r.buf)
	buf := &r.buf[i]
	return buf.ch, buf.pos
}
887070
func (l *ReaderLexer) Current() (r rune) {
	if len(l.buf) == 0 {
		return l.Next()
	}

	return l.buf[l.peekLoc]
}
559194
func NewCurrSymbol(s string) (*CurrSymbol, error) {
	unit, err := currency.ParseISO(s)
	if err != nil {
		return nil, errors.New("Error parsing string to create new CurrSymbol:" + err.Error())
	}
	return &CurrSymbol{unit}, nil
}
205306
func (c *Client) ReadCBOR(v interface{}) (err error) {
	_, r, err := c.NextReader()
	if err != nil {
		return err
	}
	return codec.NewDecoder(r, &ch).Decode(v)
}
296339
func (c *QueuesListCall) Cursor(cursor string) *QueuesListCall {
	c.urlParams_.Set("cursor", cursor)
	return c
}
393225
func (z *Lexer) PeekRune(pos int) (rune, int) {
	// from unicode/utf8
	c := z.Peek(pos)
	if c < 0xC0 || z.Peek(pos+1) == 0 {
		return rune(c), 1
	} else if c < 0xE0 || z.Peek(pos+2) == 0 {
		return rune(c&0x1F)<<6 | rune(z.Peek(pos+1)&0x3F), 2
	} else if c < 0xF0 || z.Peek(pos+3) == 0 {
		return rune(c&0x0F)<<12 | rune(z.Peek(pos+1)&0x3F)<<6 | rune(z.Peek(pos+2)&0x3F), 3
	}
	return rune(c&0x07)<<18 | rune(z.Peek(pos+1)&0x3F)<<12 | rune(z.Peek(pos+2)&0x3F)<<6 | rune(z.Peek(pos+3)&0x3F), 4
}
535440
func (c *Cursor) Next() (key []byte, value []byte) {
	c.next()
	c.updateCurr()
	for c.checkCurrDeleted() {
		c.next()
		c.updateCurr()
	}
	// FIXME end case where nothing else?
	return c.key[c.curr], c.val[c.curr]
}
349590
func Rparse(str, sep string) *Pair {
	return parse(str, strings.LastIndex(str, sep))
}
456686
func (vm *Engine) curPC() (script int, off int, err error) {
	err = vm.validPC()
	if err != nil {
		return 0, 0, err
	}
	return vm.scriptIdx, vm.scriptOff, nil
}
288998
func (r *Reader) Err() error {
	if r.err == io.EOF {
		return nil
	}
	return r.err
}
928770
func (bt backpressureTracker) currLimit() float64 {
	// Calculate k(U+F), converting to float64 first to avoid
	// overflow, although losing some precision in the process.
	usedFloat := float64(bt.used)
	freeFloat := float64(bt.free)
	limit := bt.limitFrac * (usedFloat + freeFloat)
	minLimit := math.Min(limit, float64(bt.limit))
	// Based on local tests, the magic number of 512 gets us past overflow
	// issues at the limit due to floating point precision.
	maxFloatForInt64 := float64(math.MaxInt64 - 512)
	if minLimit > maxFloatForInt64 {
		minLimit = maxFloatForInt64
	}
	return minLimit
}
203827
func (s *Scanner) err(msg string) {
	s.ErrorCount++
	pos := s.recentPosition()

	if s.Error != nil {
		s.Error(pos, msg)
		return
	}

	fmt.Fprintf(os.Stderr, "%s: %s\n", pos, msg)
}
412453
func NewTar(path string) (*TarReader, error) {
	file, err := os.Open(path)
	if err != nil {
		return nil, err
	}

	tr := tar.NewReader(file)
	return &TarReader{file: file, gz: nil, tr: tr}, nil
}
1102347
func (tr Row) FloatErr(nn int) (val float64, err error) {
	switch data := tr[nn].(type) {
	case nil:
		// nop
	case float64, float32:
		val = reflect.ValueOf(data).Float()
	case int64, int32, int16, int8:
		i := reflect.ValueOf(data).Int()
		if i >= 2<<53 || i <= -(2<<53) {
			err = strconv.ErrRange
		} else {
			val = float64(i)
		}
	case uint64, uint32, uint16, uint8:
		u := reflect.ValueOf(data).Uint()
		if u >= 2<<53 {
			err = strconv.ErrRange
		} else {
			val = float64(u)
		}
	case []byte:
		val, err = strconv.ParseFloat(string(data), 64)
	case *[]byte:
		val, err = strconv.ParseFloat(string(*data), 64)
	default:
		err = os.ErrInvalid
	}
	return
}
1110732
func (b *Buffer) CursorLeft(count int) {
	l := b.Document().GetCursorLeftPosition(count)
	b.cursorPosition += l
	return
}
295072
func (state *LockState) currLocked() *exclusionState {
	stateCount := len(state.exclusionStates)
	if stateCount == 0 {
		return nil
	}
	return &state.exclusionStates[stateCount-1]
}
768393
func (r *tokenReader) buffer() (rune, error) {
	rn, _, err := r.r.ReadRune()
	if err != nil {
		return 0, err
	}
	r.runes = append(r.runes, rn)
	return rn, nil
}