// ReadAt converts token ID back to string.
179913
func (pool *stringPool) ReadAt(index TokenID) (string, error) {
	if index < TokenID(0) || index >= TokenID(len(pool.items)) {
		return "", errors.New("index out of range")
	}
	pool.RLock()
	item := pool.items[int(index)]
	pool.RUnlock()
	compressed := pool.buffer.Bytes()[item.begin:item.end]
	decompressed, error := smaz.Decompress(compressed)
	if error != nil {
		return "", error
	}
	return string(decompressed), nil
}
680319
func (s *SeqSet) insertAt(i int, v Seq) {
	if n := len(s.Set); i == n {
		// insert at the end
		s.Set = append(s.Set, v)
		return
	} else if n < cap(s.Set) {
		// enough space, shift everything at and after i to the right
		s.Set = s.Set[:n+1]
		copy(s.Set[i+1:], s.Set[i:])
	} else {
		// allocate new slice and copy everything, n is at least 1
		set := make([]Seq, n+1, n*2)
		copy(set, s.Set[:i])
		copy(set[i+1:], s.Set[i:])
		s.Set = set
	}
	s.Set[i] = v
}
1113988
func parseSet(t *Tree, start Pos) (Node, error) {
	tok, err := t.expect(tokenName)
	if err != nil {
		return nil, err
	}
	_, err = t.expectValue(tokenPunctuation, "=")
	if err != nil {
		return nil, err
	}
	expr, err := t.parseExpr()
	if err != nil {
		return nil, err
	}
	_, err = t.expect(tokenTagClose)
	if err != nil {
		return nil, err
	}
	return NewSetNode(tok.value, expr, start), nil
}
553992
func (r Rope) ReadAt(p []byte, off int64) (n int, err error) {
	expected := len(p)
	if off < 0 {
		return 0, errors.New("Rope.ReadAt: invalid offset")
	}

	if len(p) == 0 {
		return
	}

	if r.node == nil {
		if len(p) > 0 {
			err = io.EOF
		}
		return
	}
	n = r.node.readAt(p, off)
	if n < expected {
		err = io.EOF
	}
	return
}
51784
func (s Slice) ValueAt(index ValueLength) (Slice, error) {
	if !s.IsObject() {
		return nil, InvalidTypeError{"Expecting type Object"}
	}

	key, err := s.getNthKey(index, false)
	if err != nil {
		return nil, WithStack(err)
	}
	byteSize, err := key.ByteSize()
	if err != nil {
		return nil, WithStack(err)
	}
	return Slice(key[byteSize:]), nil
}
972827
func (br *bufReader) ReadText(encoding Encoding) []byte {
	if br.err != nil {
		return nil
	}

	var text []byte
	delims := encoding.TerminationBytes
	text, br.err = br.readTillDelims(delims)
	br.Discard(len(delims))

	return text
}
1286896
func (f *File) ReadAt(p []byte, off int64) (n int, err error) {
	// ReadAt doesn't affect the underlying offset.
	readBytes, err := f.fs.config.KBFSOps().Read(f.fs.ctx, f.node, p, off)
	if err != nil {
		return 0, err
	}
	if int(readBytes) < len(p) {
		// ReadAt is more strict than Read.
		return 0, errors.Errorf("Could only read %d bytes", readBytes)
	}

	return int(readBytes), nil
}
683356
func (this *import_data_parser) read_ident() string {
	id := ""
	prev := rune(0)

loop:
	for {
		switch this.toktype {
		case scanner.Ident:
			if prev == scanner.Ident {
				break loop
			}

			prev = this.toktype
			id += this.token()
			this.next()
		case '.', '?', '$':
			prev = this.toktype
			id += string(this.toktype)
			this.next()
		default:
			break loop
		}
	}

	if id == "" {
		this.errorf("identifier expected, got %s", scanner.TokenString(this.toktype))
	}
	return id
}
873529
func (lir *LookupInResult) DecodeAt(idx int, valuePtr interface{}, decode Decode) error {
	if idx > len(lir.contents) {
		return errors.New("the supplied index was invalid")
	}
	if decode == nil {
		decode = JSONDecode
	}
	return lir.contents[idx].as(valuePtr, decode)
}
1320265
func (s *Segment) ReadAt(p []byte, off int64) (n int, err error) {
	s.Lock()
	defer s.Unlock()
	return s.log.ReadAt(p, off)
}
773202
func (e ext) ReadExt(v interface{}, buf []byte) {
	err := e.codec.Decode(buf, v)
	if err != nil {
		panic(fmt.Sprintf("Couldn't decode data into %v", v))
	}
}
275968
func (t *keyValueTree) CopyAt(keys ...string) (KeyValueTree, error) {
	var path []nodeContent
	for _, key := range keys {
		path = append(path, keyValue{key, ""})
	}
	n, err := t.container.root.at(path...)
	if err != nil {
		return nil, err
	}
	nc := &nodeContainer{
		duplicates: t.container.duplicates,
	}
	nc.root = n.deepCopy(nc, nil)
	return &keyValueTree{nc}, nil
}
115
func (p *parser) readv(t token) ([]token, error) {
	var tokens []token
	for {
		read, err := p.readt(t.typ)
		tokens = append(tokens, read...)
		if err != nil {
			return tokens, err
		}
		if len(read) > 0 && read[len(read)-1].val == t.val {
			break
		}
	}
	return tokens, nil
}
841981
func (b *MemFile) ReadAt(p []byte, off int64) (n int, err error) {
	b.mutex.RLock()
	n, err = b.Buffer.ReadAt(p, off)
	b.mutex.RUnlock()
	return
}
1214861
func (br *Reader) readRawData() {
	buf := br.dict.WriteSlice()
	if len(buf) > br.blkLen {
		buf = buf[:br.blkLen]
	}

	cnt, err := br.rd.Read(buf)
	br.blkLen -= cnt
	br.dict.WriteMark(cnt)
	if err != nil {
		if err == io.EOF {
			err = io.ErrUnexpectedEOF
		}
		errors.Panic(err)
	}

	if br.blkLen > 0 {
		br.toRead = br.dict.ReadFlush()
		br.step = (*Reader).readRawData // We need to continue this work
		return
	}
	br.step = (*Reader).readBlockHeader
}
370759
func (b *WriteAtBuffer) WriteAt(p []byte, pos int64) (n int, err error) {
	pLen := len(p)
	expLen := pos + int64(pLen)
	b.m.Lock()
	defer b.m.Unlock()
	if int64(len(b.buf)) < expLen {
		if int64(cap(b.buf)) < expLen {
			if b.GrowthCoeff < 1 {
				b.GrowthCoeff = 1
			}
			newBuf := make([]byte, expLen, int64(b.GrowthCoeff*float64(expLen)))
			copy(newBuf, b.buf)
			b.buf = newBuf
		}
		b.buf = b.buf[:expLen]
	}
	copy(b.buf[pos:], p)
	return pLen, nil
}
94852
func (p *Peeker) Read() *Token {
	token := p.Peek()

	// As a special case, we will produce the EOF token forever once
	// it is reached.
	if token.Type != EOF {
		p.peeked = nil
	}

	return token
}