// Parse looks up the filename in the underlying Asset store,
// then calls the underlying template's Parse function with the result.
// returns an error if the file wasn't found or the Parse call failed
969180
func (t *Template) Parse(filename string) (*Template, error) {
	tmplBytes, err := t.file(filename)
	if err != nil {
		return nil, err
	}
	newTmpl, err := t.tmpl.Parse(string(tmplBytes))
	if err != nil {
		return nil, err
	}
	return t.replaceTmpl(newTmpl), nil
}
718630
func (p *Project) Parse() error {
	err := p.context.open()
	if err != nil {
		return err
	}

	p.Name = p.context.ProjectName

	p.Files = p.context.ComposeFiles

	if len(p.Files) == 1 && p.Files[0] == "-" {
		p.Files = []string{"."}
	}

	if p.context.ComposeBytes != nil {
		for i, composeBytes := range p.context.ComposeBytes {
			file := ""
			if i < len(p.context.ComposeFiles) {
				file = p.Files[i]
			}
			if err := p.load(file, composeBytes); err != nil {
				return err
			}
		}
	}

	return nil
}
115752
func (f *FlagSets) Parse(args []string) error {
	return f.mainSet.Parse(args)
}
173824
func Parse(cmd interface{}, opts ...parseOpt) {
	opts = append([]parseOpt{Program(filepath.Base(os.Args[0]))}, opts...)
	ParseArgs(cmd, os.Args[1:], opts...)
}
1082633
func Parse(tmpl string) (Compiler, error) {
	if !strings.HasPrefix(tmpl, "/") {
		return template{}, InvalidTemplateError{tmpl: tmpl, msg: "no leading /"}
	}
	tokens, verb := tokenize(tmpl[1:])

	p := parser{tokens: tokens}
	segs, err := p.topLevelSegments()
	if err != nil {
		return template{}, InvalidTemplateError{tmpl: tmpl, msg: err.Error()}
	}

	return template{
		segments: segs,
		verb:     verb,
		template: tmpl,
	}, nil
}
860453
func Parse(filename string) (RootList, error) {
	cfgMap, err := ParseToRawMap(filename)
	if err != nil {
		return nil, err
	}

	var rootList = RootList{}
	for label, entries := range cfgMap {
		root, err := LoadRoot(entries)
		if err != nil {
			return nil, err
		}

		rootList[label] = root
	}

	return rootList, nil
}
473279
func Parse(r io.Reader) (*Template, error) {
	// Create a buffer to copy what we read
	var buf bytes.Buffer
	if _, err := buf.ReadFrom(r); err != nil {
		return nil, err
	}

	// First, decode the object into an interface{}. We do this instead of
	// the rawTemplate directly because we'd rather use mapstructure to
	// decode since it has richer errors.
	var raw interface{}
	if err := json.Unmarshal(buf.Bytes(), &raw); err != nil {
		return nil, err
	}

	// Create our decoder
	var md mapstructure.Metadata
	var rawTpl rawTemplate
	rawTpl.RawContents = buf.Bytes()
	decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
		Metadata: &md,
		Result:   &rawTpl,
	})
	if err != nil {
		return nil, err
	}

	// Do the actual decode into our structure
	if err := decoder.Decode(raw); err != nil {
		return nil, err
	}

	// Build an error if there are unused root level keys
	if len(md.Unused) > 0 {
		sort.Strings(md.Unused)

		unusedMap, ok := raw.(map[string]interface{})
		if !ok {
			return nil, fmt.Errorf("Failed to convert unused root level keys to map")
		}

		for _, unused := range md.Unused {
			if unused[0] == '_' {
				commentVal, ok := unusedMap[unused].(string)
				if !ok {
					return nil, fmt.Errorf("Failed to cast root level comment value to string")
				}

				comment := map[string]string{
					unused: commentVal,
				}

				rawTpl.Comments = append(rawTpl.Comments, comment)
				continue
			}

			err = multierror.Append(err, fmt.Errorf(
				"Unknown root level key in template: '%s'", unused))
		}
	}
	if err != nil {
		return nil, err
	}

	// Return the template parsed from the raw structure
	return rawTpl.Template()
}
641761
func (n *Name) Parse(reader io.ReadSeeker) error {
	err := encoding.Unmarshal(reader, &n.OffsetPrevString, Endianness)
	if err != nil {
		return err
	}
	err = encoding.Unmarshal(reader, &n.Hash, Endianness)
	if err != nil {
		return err
	}
	err = encoding.Unmarshal(reader, &n.Size, Endianness)
	if err != nil {
		return err
	}

	// No need to control size since it is uint16
	n.UTF16String = make([]uint16, n.Size+1)

	err = encoding.UnmarshaInitSlice(reader, &n.UTF16String, Endianness)
	return err
}
928956
func Parse(args []string, argv interface{}) error {
	clr := color.Color{}
	fset := parseArgv(args, argv, clr)
	return fset.err
}
716165
func (r *Reader) parse(file *os.File) *File {
	status := &File{}

	sc := bufio.NewScanner(file)
	for sc.Scan() {
		parts := strings.Split(sc.Text(), ":")
		if len(parts) < 2 {
			continue
		}
		label := prune(parts[0])
		var err error
		switch label {
		case "Name":
			status.Name = prune(parts[1])
		case "Umask":
			if status.UMask, err = strconv.Atoi(prune(parts[1])); err != nil {

			}
		case "State":
			valuePts := strings.Split(parts[1], " ")
			if len(valuePts) == 2 {
				status.LState = prune(valuePts[0])
				state := strings.Replace(valuePts[1], "(", "", 1)
				state = strings.Replace(state, ")", "", 1)
				status.State = ProcessStatus(prune(state))
			}
		case "Tgid":
			status.Tgid = r.toInt(parts[1])
		case "Ngid":
			status.Ngid = r.toInt(parts[1])
		case "Pid":
			status.Pid = r.toInt(parts[1])
		case "PPid":
			status.PPid = r.toInt(parts[1])
		case "TracerPid":
			status.TracerPid = r.toInt(parts[1])
		case "Uid":
			status.UID = r.guid(parts[1])
		case "Gid":
			status.GID = r.guid(parts[1])
		case "FDSize":
			status.FDSize = r.toInt(parts[1])
		case "Groups":
			groups := strings.Split(parts[1], " ")
			if len(groups) == 0 {
				status.Groups = []int{0}
			} else {
				for _, group := range groups {
					if group == "" {
						continue
					}
					groupIdx := r.toInt(group)
					status.Groups = append(status.Groups, groupIdx)
				}
			}
		case "NStgid":
			status.NStgid = r.toInt(parts[1])
		case "NSpid":
			status.NSpid = r.toInt(parts[1])
		case "NSpgid":
			status.NSpgid = r.toInt(parts[1])
		case "NSsid":
			status.NSsid = r.toInt(parts[1])
		case "VmPeak":
			status.VMPeak = prune(parts[1])
		case "VmSize":
			status.VMSize = prune(parts[1])
		case "VmLck":
			status.VMLck = prune(parts[1])
		case "VmPin":
			status.VMPin = prune(parts[1])
		case "VmHWM":
			status.VMHWM = prune(parts[1])
		case "VmRSS":
			status.VMRSS = prune(parts[1])
		case "RssAnon":
			status.RssAnon = prune(parts[1])
		case "RssFile":
			status.RssFile = prune(parts[1])
		case "RssShmem":
			status.RssShmem = prune(parts[1])
		case "VmData":
			status.VMData = prune(parts[1])
		case "VmStk":
			status.VMStk = prune(parts[1])
		case "VmExe":
			status.VMExe = prune(parts[1])
		case "VmLib":
			status.VMLib = prune(parts[1])
		case "VmPTE":
			status.VMPTE = prune(parts[1])
		case "VmSwap":
			status.VMSwap = prune(parts[1])
		case "HugetlbPages":
			status.HugetlbPages = prune(parts[1])
		case "CoreDumping":
			status.CoreDumping = r.toInt(parts[1])
		case "Threads":
			status.Threads = r.toInt(parts[1])
		case "SigQ":
			valuePts := strings.Split(parts[1], "/")
			if len(valuePts) == 2 {
				status.SigQueued = r.toInt(valuePts[0])
				status.SigMax = r.toInt(valuePts[1])
			}
		case "SigPnd":
			status.SigPnd = r.toHex(parts[1])
		case "ShdPnd":
			status.ShdPnd = r.toHex(parts[1])
		case "SigBlk":
			status.SigBlk = r.toHex(parts[1])
		case "SigIgn":
			status.SigIgn = r.toHex(parts[1])
		case "SigCgt":
			status.SigCgt = r.toHex(parts[1])
		case "CapInh":
			status.CapInh = r.toHex(parts[1])
		case "CapPrm":
			status.CapPrm = r.toHex(parts[1])
		case "CapEff":
			status.CapEff = r.toHex(parts[1])
		case "CapBnd":
			status.CapBnd = r.toHex(parts[1])
		case "Seccomp":
			status.Seccomp = r.toInt(parts[1])
		case "Cpus_allowed":
			status.CpusAllowed = prune(parts[1])
		case "MemsAllowed_list":
			status.MemsAllowedList = r.toInt(parts[1])
		case "voluntary_ctxt_switches":
			status.VoluntaryCtxtSwitches = r.toInt(parts[1])
		case "nonvoluntary_ctxt_switches":
			status.NonvoluntaryCtxtSwitches = r.toInt(parts[1])
		}
	}

	return status
}
397612
func Parse(v interface{}) (Cid, error) {
	switch v2 := v.(type) {
	case string:
		if strings.Contains(v2, "/ipfs/") {
			return Decode(strings.Split(v2, "/ipfs/")[1])
		}
		return Decode(v2)
	case []byte:
		return Cast(v2)
	case mh.Multihash:
		return NewCidV0(v2), nil
	case Cid:
		return v2, nil
	default:
		return Undef, fmt.Errorf("can't parse %+v as Cid", v2)
	}
}
1053043
func (o *Options) Parse(args []string) error {
	if err := o.fs.Parse(args); err != nil {
		return err
	}
	return o.ParseError()
}
497271
func Parse(r io.Reader) (*Template, error) {
	t := New()
	err := t.Parse(r)
	return t, err
}
1267327
func (c *Compiler) Parse(input string) (err error) {
	defer func() {
		if r := recover(); r != nil {
			err = errors.New(r.(string))
		}
	}()

	parser, err := parser.StringParser(input)
    parser.FileName(c.filename)

	if err != nil {
		return
	}

	c.node = parser.Parse()
	return
}
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)
}
514080
func Parse(err string) *Error {
	e := new(Error)
	errr := json.Unmarshal([]byte(err), e)
	if errr != nil {
		e.Detail = err
	}
	return e
}
330333
func Parse(name string, text string) (*Config, error) {
	p := &parser{name: name, text: text}
	err := p.parse()
	if err != nil {
		return nil, err
	}
	return p.config, nil
}