// Parse returns a ConfigContainer with parsed json config map.
11187
func (js *JSONConfig) Parse(filename string) (Configer, error) {
	file, err := os.Open(filename)
	if err != nil {
		return nil, err
	}
	defer file.Close()
	content, err := ioutil.ReadAll(file)
	if err != nil {
		return nil, err
	}

	return js.ParseData(content)
}
127572
func Parse(text string) (t *Tree, err error) {
	t = New()
	t.Text = text
	err = t.Parse(text)
	return
}
482309
func Parse(value string) (GUID, error) {
	var guid GUID
	for _, fullFormat := range knownFormats {
		parity, err := fmt.Sscanf(
			value,
			fullFormat,
			&guid.timeLow,
			&guid.timeMid,
			&guid.timeHighAndVersion,
			&guid.clockSeqHighAndReserved,
			&guid.clockSeqLow,
			&guid.node[0],
			&guid.node[1],
			&guid.node[2],
			&guid.node[3],
			&guid.node[4],
			&guid.node[5])
		if parity == 11 && err == nil {
			return guid, err
		}
	}
	return emptyGUID, fmt.Errorf("\"%s\" is not in a recognized format", value)
}
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
}
666003
func Parse(input string) (*Template, error) {
	moot.Lock()
	defer moot.Unlock()
	if t, ok := cache[input]; ok {
		return t, nil
	}
	t, err := NewTemplate(input)

	if err == nil {
		cache[input] = t
	}

	if err != nil {
		return t, errors.WithStack(err)
	}

	return t, nil
}
1239002
func Parse(s string) (r T, err error) {
	_, err = fmt.Sscan(s,
		&r.A.Point[0], &r.A.Point[1], &r.A.Point[2],
		&r.A.Tangent[0], &r.A.Tangent[1], &r.A.Tangent[2],
		&r.B.Point[0], &r.B.Point[1], &r.B.Point[2],
		&r.B.Tangent[0], &r.B.Tangent[1], &r.B.Tangent[2],
	)
	return r, err
}
603990
func (p IntParser) Parse(field string) (result interface{}, err error) {
	return strconv.ParseInt(field, 10, 64)
}
1241193
func Parse(pkg *genbase.PackageInfo, typeInfos genbase.TypeInfos) (*BuildSource, error) {
	bu := &BuildSource{
		g:         genbase.NewGenerator(pkg),
		pkg:       pkg,
		typeInfos: typeInfos,
	}

	bu.g.AddImport("google.golang.org/appengine/datastore", "")
	bu.g.AddImport("github.com/favclip/qbg/qbgutils", "")

	for _, typeInfo := range typeInfos {
		err := bu.parseStruct(typeInfo)
		if err != nil {
			return nil, err
		}
	}

	return bu, nil
}
841152
func (env *Env) Parse(name string) (*parse.Tree, error) {
	return env.load(name)
}
534049
func (g *Grok) Parse(pattern, text string) (map[string]string, error) {
	gr, err := g.compile(pattern)
	if err != nil {
		return nil, err
	}

	return g.compiledParse(gr, text)
}
838653
func (jsonConf *JSONConf) Parse(conf io.Reader) ([]*Job, error) {
	buf, err := ioutil.ReadAll(conf)
	if err != nil {
		log.Fatal(err)
	}

	var c []*Job
	err = json.Unmarshal(buf, &c)
	if err != nil {
		return nil, err
	}

	return c, nil
}
487478
func (v *Var) Parse(field reflect.StructField) error {
	v.SetName(field.Name)
	v.SetType(field.Type)
	v.SetKey(v.Name)

	tag := field.Tag.Get("env")

	if tag == "" {
		return nil
	}

	tagParams := strings.Split(tag, " ")
	for _, tagParam := range tagParams {
		var key, value string

		option := strings.Split(tagParam, "=")
		key = option[0]
		if len(option) > 1 {
			value = option[1]
		}

		switch key {
		case "key":
			// override the default key if one is specified
			v.SetKey(value)
		case "required":
			// val, _ := strconv.ParseBool(value)
			// if val != false {
			v.SetRequired(true)
			// }
		case "default":
			d, err := convert(v.Type, value)
			if err != nil {
				return err
			}
			v.SetDefault(d)
		case "options":
			in := strings.Split(value, ",")
			// var values []reflect.Value
			values := make([]reflect.Value, len(in))
			for k, val := range in {
				v1, err := convert(v.Type, val)
				if err != nil {
					return err
				}
				values[k] = v1
			}
			v.SetOptions(values)
		}
	}

	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
}
502323
func Parse(re string, op RegexOptions) (*RegexTree, error) {
	p := parser{
		options: op,
		caps:    make(map[int]int),
	}
	p.setPattern(re)

	if err := p.countCaptures(); err != nil {
		return nil, err
	}

	p.reset(op)
	root, err := p.scanRegex()

	if err != nil {
		return nil, err
	}
	tree := &RegexTree{
		root:       root,
		caps:       p.caps,
		capnumlist: p.capnumlist,
		captop:     p.captop,
		Capnames:   p.capnames,
		Caplist:    p.capnamelist,
		options:    op,
	}

	if tree.options&Debug > 0 {
		os.Stdout.WriteString(tree.Dump())
	}

	return tree, nil
}
599461
func (c *Configure) Parse() {
	c.setup()
	for _, opt := range c.options {
		changed := false
		for _, checker := range c.stack {
			switch opt.typ {
			case stringType:
				s, err := checker.String(opt.name)
				if err != nil {
					continue
				}

				opt.set(s)
			case intType:
				i, err := checker.Int(opt.name)
				if err != nil {
					continue
				}

				opt.set(i)
			case boolType:
				b, err := checker.Bool(opt.name)
				if err != nil {
					continue
				}

				opt.set(b)
			}

			changed = true
			break
		}

		if !changed {
			opt.set(opt.def)
		}
	}
}
1201755
func (d *DateString) Parse(value string) (time.Time, error) {
	return time.Parse(d.Layout, value)
}
1342397
func Parse(pkg *genbase.PackageInfo, typeInfos genbase.TypeInfos, opts *ParseOptions) (*BuildSource, error) {
	bu := &BuildSource{
		g:         genbase.NewGenerator(pkg),
		pkg:       pkg,
		typeInfos: typeInfos,
	}

	if opts != nil {
		for _, tagName := range opts.TranscriptTagNames {
			if tagName == "json" {
				return nil, ErrInvalidTranscriptTags
			}
		}

		bu.transcriptTagNames = opts.TranscriptTagNames
		bu.noOmitempty = opts.NoOmitempty
		bu.noOmitemptyFieldTypes = opts.NoOmitemptyFieldTypes
	}

	bu.g.AddImport("encoding/json", "")

	for _, typeInfo := range typeInfos {
		err := bu.parseStruct(typeInfo)
		if err != nil {
			return nil, err
		}
	}

	return bu, nil
}