// Parse will return a map of keys to interface{}, although concrete types
// underly them. The values supported are string, bool, int64, float64, DateTime.
// Arrays and nested Maps are also supported.
347320
func Parse(data string) (map[string]interface{}, error) {
	p, err := parse(data, "", false)
	if err != nil {
		return nil, err
	}
	return p.mapping, nil
}
1270746
func Parse(env []string) ([]Constraint, error) {
	exprs := []Constraint{}
	for _, e := range env {
		found := false
		// each expr is in the form of "key op value"
		for i, op := range operators {
			if !strings.Contains(e, op) {
				continue
			}
			// split with the op
			parts := strings.SplitN(e, op, 2)

			if len(parts) < 2 {
				return nil, fmt.Errorf("invalid expr: %s", e)
			}

			part0 := strings.TrimSpace(parts[0])
			// validate key
			matched := alphaNumeric.MatchString(part0)
			if !matched {
				return nil, fmt.Errorf("key '%s' is invalid", part0)
			}

			part1 := strings.TrimSpace(parts[1])

			// validate Value
			matched = valuePattern.MatchString(part1)
			if !matched {
				return nil, fmt.Errorf("value '%s' is invalid", part1)
			}
			// TODO(dongluochen): revisit requirements to see if globing or regex are useful
			exprs = append(exprs, Constraint{key: part0, operator: i, exp: part1})

			found = true
			break // found an op, move to next entry
		}
		if !found {
			return nil, fmt.Errorf("constraint expected one operator from %s", strings.Join(operators, ", "))
		}
	}
	return exprs, nil
}
1192193
func (mo *Mo) Parse(buf []byte) {
	// Lock while parsing
	mo.Lock()

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

	r := bytes.NewReader(buf)

	var magicNumber uint32
	if err := binary.Read(r, binary.LittleEndian, &magicNumber); err != nil {
		return
		// return fmt.Errorf("gettext: %v", err)
	}
	var bo binary.ByteOrder
	switch magicNumber {
	case MoMagicLittleEndian:
		bo = binary.LittleEndian
	case MoMagicBigEndian:
		bo = binary.BigEndian
	default:
		return
		// return fmt.Errorf("gettext: %v", "invalid magic number")
	}

	var header struct {
		MajorVersion uint16
		MinorVersion uint16
		MsgIDCount   uint32
		MsgIDOffset  uint32
		MsgStrOffset uint32
		HashSize     uint32
		HashOffset   uint32
	}
	if err := binary.Read(r, bo, &header); err != nil {
		return
		// return fmt.Errorf("gettext: %v", err)
	}
	if v := header.MajorVersion; v != 0 && v != 1 {
		return
		// return fmt.Errorf("gettext: %v", "invalid version number")
	}
	if v := header.MinorVersion; v != 0 && v != 1 {
		return
		// return fmt.Errorf("gettext: %v", "invalid version number")
	}

	msgIDStart := make([]uint32, header.MsgIDCount)
	msgIDLen := make([]uint32, header.MsgIDCount)
	if _, err := r.Seek(int64(header.MsgIDOffset), 0); err != nil {
		return
		// return fmt.Errorf("gettext: %v", err)
	}
	for i := 0; i < int(header.MsgIDCount); i++ {
		if err := binary.Read(r, bo, &msgIDLen[i]); err != nil {
			return
			// return fmt.Errorf("gettext: %v", err)
		}
		if err := binary.Read(r, bo, &msgIDStart[i]); err != nil {
			return
			// return fmt.Errorf("gettext: %v", err)
		}
	}

	msgStrStart := make([]int32, header.MsgIDCount)
	msgStrLen := make([]int32, header.MsgIDCount)
	if _, err := r.Seek(int64(header.MsgStrOffset), 0); err != nil {
		return
		// return fmt.Errorf("gettext: %v", err)
	}
	for i := 0; i < int(header.MsgIDCount); i++ {
		if err := binary.Read(r, bo, &msgStrLen[i]); err != nil {
			return
			// return fmt.Errorf("gettext: %v", err)
		}
		if err := binary.Read(r, bo, &msgStrStart[i]); err != nil {
			return
			// return fmt.Errorf("gettext: %v", err)
		}
	}

	for i := 0; i < int(header.MsgIDCount); i++ {
		if _, err := r.Seek(int64(msgIDStart[i]), 0); err != nil {
			return
			// return fmt.Errorf("gettext: %v", err)
		}
		msgIDData := make([]byte, msgIDLen[i])
		if _, err := r.Read(msgIDData); err != nil {
			return
			// return fmt.Errorf("gettext: %v", err)
		}

		if _, err := r.Seek(int64(msgStrStart[i]), 0); err != nil {
			return
			// return fmt.Errorf("gettext: %v", err)
		}
		msgStrData := make([]byte, msgStrLen[i])
		if _, err := r.Read(msgStrData); err != nil {
			return
			// return fmt.Errorf("gettext: %v", err)
		}

		if len(msgIDData) == 0 {
			mo.addTranslation(msgIDData, msgStrData)
		} else {
			mo.addTranslation(msgIDData, msgStrData)
		}
	}

	// Unlock to parse headers
	mo.Unlock()

	// Parse headers
	mo.parseHeaders()
	return
	// return nil
}
183644
func (nulls *Nulls) Parse(value interface{}) interface{} {
	switch nulls.Value.(type) {
	case Int:
		return NewInt(value.(int))
	case Int64:
		return NewInt64(value.(int64))
	case UUID:
		return NewUUID(value.(uuid.UUID))
	default:
		return value
	}
}
597448
func (m *tokenManager) Parse(ctx context.Context, tokenString string) (*jwt.Token, error) {
	keyFunc := m.KeyFunction(ctx)
	jwtToken, err := jwt.Parse(tokenString, keyFunc)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err": err,
		}, "unable to parse token")
		return nil, autherrors.NewUnauthorizedError(err.Error())
	}
	return jwtToken, nil
}
560666
func (m *Matter) Parse(input io.Reader) (front map[string]interface{}, body string, err error) {
	return m.parse(input)
}
1276949
func Parse(in io.Reader) (*Set, error) {
	m := make(map[string]interface{})
	if err := json.NewDecoder(in).Decode(&m); err != nil {
		return nil, errors.Wrap(err, "failed to unmarshal JWK")
	}

	// We must change what the underlying structure that gets decoded
	// out of this JSON is based on parameters within the already parsed
	// JSON (m). In order to do this, we have to go through the tedious
	// task of parsing the contents of this map :/
	if _, ok := m["keys"]; ok {
		var set Set
		if err := set.ExtractMap(m); err != nil {
			return nil, errors.Wrap(err, `failed to extract from map`)
		}
		return &set, nil
	}

	k, err := constructKey(m)
	if err != nil {
		return nil, errors.Wrap(err, `failed to construct key from keys`)
	}
	return &Set{Keys: []Key{k}}, nil
}
786641
func (s *HTTPServer) parse(resp http.ResponseWriter, req *http.Request, dc *string, b *structs.QueryOptions) bool {
	return s.parseInternal(resp, req, dc, b, true)
}
58245
func (m *GenericParser) Parse(data interface{}) (e *Entity, err error) {
	val := reflect.ValueOf(data)
	// dereference pointers, and get concrete values from interfaces
	val = deref(val)
	// Map and Struct are the only valid Kinds at the top level.
	switch val.Kind() {
	case reflect.Map:
		e, err = m.parseMap(val)
	case reflect.Struct:
		e, err = m.parseStruct(val)
	default:
		e, err = nil, errors.Errorf("unsupported kind, '%v' in GenericParser: %v", val.Kind(), data)
	}
	if err != nil {
		return e, err
	}
	var subj string
	if !m.SubjectAll {
		if m.EntitySubjecter != nil {
			subj, err = m.EntitySubjecter.Subject(e)
		} else {
			subj, err = m.Subjecter.Subject(data)
		}
		e.Subject = IRI(subj)
	}
	return e, err
}
871432
func Parse(qStr string) (Q, error) {
	b := []byte(qStr)

	qs, _, err := parseExprList(b)
	if err != nil {
		return nil, err
	}

	q, err := parseOperators(qs)
	if err != nil {
		return nil, err
	}

	return Simplify(q), nil
}
932909
func Parse(timeStr string) (time.Time, error) {
	err := errors.New("provided string is not W3C-DTF format")

	if !strings.Contains(timeStr, "T") {
		switch true {
		case IsYear(timeStr):
			return ParseYear(timeStr)
		case IsYearAndMonth(timeStr):
			return ParseYearAndMonth(timeStr)
		case IsCompleteDate(timeStr):
			return ParseCompleteDate(timeStr)
		default:
			return time.Time{}, err
		}
	} else {
		switch true {
		case IsCompleteDateWithMinutes(timeStr):
			return ParseCompleteDateWithMinutes(timeStr)
		case IsCompleteDateWithSeconds(timeStr):
			return ParseCompleteDateWithSeconds(timeStr)
		case IsCompleteDateWithFractionOfSecond(timeStr):
			return ParseCompleteDateWithFractionOfSecond(timeStr)
		default:
			return time.Time{}, err
		}
	}
}
581942
func (pub *DSAPublicKey) Parse(in []byte) (index []byte, ok bool) {
	var typeTag uint16
	if index, typeTag, ok = gotrax.ExtractShort(in); !ok || typeTag != dsaKeyTypeValue {
		return in, false
	}
	if index, pub.P, ok = gotrax.ExtractMPI(index); !ok {
		return in, false
	}
	if index, pub.Q, ok = gotrax.ExtractMPI(index); !ok {
		return in, false
	}
	if index, pub.G, ok = gotrax.ExtractMPI(index); !ok {
		return in, false
	}
	if index, pub.Y, ok = gotrax.ExtractMPI(index); !ok {
		return in, false
	}
	return
}
926318
func (parser IntTypeParser) Parse(d DataType) error {
	if value, ok := AsInt(d); ok {
		parser.setter(value)
	} else {
		return fmt.Errorf("Error parsing type of %#v as an Integer", d)
	}
	return nil
}
393985
func Parse(data []byte) (*Config, error) {
	v := struct {
		Image     string
		Build     *Build
		Workspace *Workspace
		Services  containerList
		Pipeline  containerList
		Networks  networkList
		Volumes   volumeList
	}{}

	err := yaml.Unmarshal(data, &v)
	if err != nil {
		return nil, err
	}

	for _, c := range v.Services.containers {
		c.Detached = true
	}

	return &Config{
		Image:     v.Image,
		Build:     v.Build,
		Workspace: v.Workspace,
		Services:  v.Services.containers,
		Pipeline:  v.Pipeline.containers,
		Networks:  v.Networks.networks,
		Volumes:   v.Volumes.volumes,
	}, nil
}
980202
func (b *boundedBuilder) Parse(s string) (*Literal, error) {
	l, err := defaultBuilder.Parse(s)
	if err != nil {
		return nil, err
	}
	t := l.Type()
	switch t {
	case Text:
		if text, err := l.Text(); err != nil || len(text) > b.max {
			return nil, fmt.Errorf("literal.Parse: cannot create literal due to size of %v (%d>%d)", t, len(text), b.max)
		}
	case Blob:
		if blob, err := l.Blob(); err != nil || len(blob) > b.max {
			return nil, fmt.Errorf("literal.Parse: cannot create literal due to size of %v (%d>%d)", t, len(blob), b.max)
		}
	}
	return l, nil
}
1240321
func Parse(buf string) (*Tree, error) {
	t := new(Tree)
	t.scanner = new(scanner)
	return t.Parse(buf)
}
344604
func (p *Parser) Parse() (plumbing.Hash, error) {
	if err := p.init(); err != nil {
		return plumbing.ZeroHash, err
	}

	if err := p.indexObjects(); err != nil {
		return plumbing.ZeroHash, err
	}

	var err error
	p.checksum, err = p.scanner.Checksum()
	if err != nil && err != io.EOF {
		return plumbing.ZeroHash, err
	}

	if err := p.resolveDeltas(); err != nil {
		return plumbing.ZeroHash, err
	}

	if err := p.onFooter(p.checksum); err != nil {
		return plumbing.ZeroHash, err
	}

	return p.checksum, nil
}