// ParseTranslationFileBytes is similar to LoadTranslationFile except it parses the bytes in buf.
//
// It is useful for parsing translation files embedded with go-bindata.
964615
func (b *Bundle) ParseTranslationFileBytes(filename string, buf []byte) error {
	basename := filepath.Base(filename)
	langs := language.Parse(basename)
	switch l := len(langs); {
	case l == 0:
		return fmt.Errorf("no language found in %q", basename)
	case l > 1:
		return fmt.Errorf("multiple languages found in filename %q: %v; expected one", basename, langs)
	}
	translations, err := parseTranslations(filename, buf)
	if err != nil {
		return err
	}
	b.AddTranslation(langs[0], translations...)
	return nil
}
1100487
func ParseFile(path string, unmarshal func([]byte, interface{}) error) (*Config, error) {
	bs, err := ioutil.ReadFile(path)
	if err != nil {
		return nil, err
	}

	conf := &Config{}
	if err := unmarshal(bs, conf); err != nil {
		return nil, err
	}

	if err := conf.Sanitize(); err != nil {
		return nil, err
	}
	return conf, nil
}
1121232
func (l *Loader) LoadBytes(in []byte) (*config.Values, error) {
	return l.LoadReader(bytes.NewReader(in))
}
1135494
func (mat *T) SetTranslation(v *vec3.T) *T {
	mat[3][0] = v[0]
	mat[3][1] = v[1]
	mat[3][2] = v[2]
	return mat
}
290187
func (f *File) ReadAt(buf []byte, offset int64) (int, error) {
	bytesRead, err := f.readAt(buf, offset)

	if f.LogLevel >= 2 {
		bytesWanted := int64(len(buf))
		start := offset
		end := offset + bytesWanted

		var readDesc string
		if bytesWanted == int64(bytesRead) {
			readDesc = "full"
		} else if bytesRead == 0 {
			readDesc = fmt.Sprintf("partial (%d of %d)", bytesRead, bytesWanted)
		} else {
			readDesc = "zero"
		}
		if err != nil {
			readDesc += fmt.Sprintf(", with err %v", err)
		}
		f.log2("[%9d-%9d] (ReadAt) %s", start, end, readDesc)
	}
	return bytesRead, err
}
132782
func ParseBytes(cfg API, input []byte) *Iterator {
	return &Iterator{
		cfg:    cfg.(*frozenConfig),
		reader: nil,
		buf:    input,
		head:   0,
		tail:   len(input),
	}
}
628557
func (f Files) GetBytes(name string) []byte {
	v, ok := f[name]
	if !ok {
		return []byte{}
	}
	return v
}
820269
func (i18n *I18n) LoadTranslations() map[string]map[string]*Translation {
	var translations = map[string]map[string]*Translation{}

	for i := len(i18n.Backends); i > 0; i-- {
		backend := i18n.Backends[i-1]
		for _, translation := range backend.LoadTranslations() {
			if translations[translation.Locale] == nil {
				translations[translation.Locale] = map[string]*Translation{}
			}
			translations[translation.Locale][translation.Key] = translation
		}
	}
	return translations
}
817902
func LoadLocaleText(l string) ([]byte, error) {
	lText, err := ioutil.ReadFile("./lang/" + l + ".json")
	if err != nil {
		return nil, errors.New("not able to read the lang file:" + err.Error())
	}

	return lText, nil
}
617862
func ReadByte(r io.Reader) (byte, error) {
	var buf [1]byte
	if _, err := r.Read(buf[:]); err != nil {
		return 0, err
	}
	return buf[0], nil
}
961729
func (matrix *Matrix) InitTranslate(tx, ty float64) {
	C.cairo_matrix_init_translate((*C.cairo_matrix_t)(unsafe.Pointer(matrix)), C.double(tx), C.double(ty))
}
119488
func ReadBytesForFile(filename string) ([]byte, error) {
	// is the filename a url?
	fileurl, _ := url.Parse(filename)
	if fileurl.Scheme != "" {
		// yes, fetch it
		bytes, err := FetchFile(filename)
		if err != nil {
			return nil, err
		}
		return bytes, nil
	}
	// no, it's a local filename
	bytes, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, err
	}
	return bytes, nil
}
552820
func ParseASTBytes(b []byte) ([]AST, error) {
	lexer := iniLexer{}
	tokens, err := lexer.tokenize(b)
	if err != nil {
		return []AST{}, err
	}

	return parse(tokens)
}
975350
func ParseFile(filename string) (interface{}, error) {
	var (
		bytes []byte
		err   error
	)
	if bytes, err = ioutil.ReadFile(filename); err != nil {
		return nil, err
	}
	return Parse(bytes)
}
324164
func (p *TCompactProtocol) ReadByte() (int8, error) {
	v, err := p.readByteDirect()
	if err != nil {
		return 0, NewTProtocolException(err)
	}
	return int8(v), err
}
946727
func (po *Po) Parse(buf []byte) {
	// Lock while parsing
	po.Lock()

	// Init storage
	if po.translations == nil {
		po.translations = make(map[string]*Translation)
		po.contexts = make(map[string]map[string]*Translation)
	}

	// Get lines
	lines := strings.Split(string(buf), "\n")

	// Init buffer
	po.trBuffer = NewTranslation()
	po.ctxBuffer = ""

	state := head
	for _, l := range lines {
		// Trim spaces
		l = strings.TrimSpace(l)

		// Skip invalid lines
		if !po.isValidLine(l) {
			continue
		}

		// Buffer context and continue
		if strings.HasPrefix(l, "msgctxt") {
			po.parseContext(l)
			state = msgCtxt
			continue
		}

		// Buffer msgid and continue
		if strings.HasPrefix(l, "msgid") && !strings.HasPrefix(l, "msgid_plural") {
			po.parseID(l)
			state = msgID
			continue
		}

		// Check for plural form
		if strings.HasPrefix(l, "msgid_plural") {
			po.parsePluralID(l)
			state = msgIDPlural
			continue
		}

		// Save Translation
		if strings.HasPrefix(l, "msgstr") {
			po.parseMessage(l)
			state = msgStr
			continue
		}

		// Multi line strings and headers
		if strings.HasPrefix(l, "\"") && strings.HasSuffix(l, "\"") {
			po.parseString(l, state)
			continue
		}
	}

	// Save last Translation buffer.
	po.saveBuffer()

	// Unlock to parse headers
	po.Unlock()

	// Parse headers
	po.parseHeaders()
}
1317112
func ParseFile(filename string) (string, error) {
	bs, err := ioutil.ReadFile(filename)
	if err != nil {
		return "", err
	}
	return Parse(filepath.Base(filename), bs)
}