// Parse tries to parse a JSON string into an error. If that
// fails, it will set the given string as the error detail.
514080
func Parse(err string) *Error {
	e := new(Error)
	errr := json.Unmarshal([]byte(err), e)
	if errr != nil {
		e.Detail = err
	}
	return e
}
952492
func (p *Parser) Parse() (*parser.Node, error) {
	sdata := string(p.data)
	rn := parser.Node{P: p, Name: p.l.ScopeName}
	defer rn.UpdateRange()
	defer func() {
		if r := recover(); r != nil {
			log.Error("Panic during parse: %v\n", r)
			log.Debug("%v", rn)
		}
	}()
	iter := maxiter
	for i := 0; i < len(sdata) && iter > 0; iter-- {
		pat, ret := p.l.RootPattern.Cache(sdata, i)
		if ret == nil {
			break
		}
		nl := strings.IndexAny(sdata[i:], "\n\r")
		// if the match object is not in this line we will move the
		// position to beginning of the next line then we will look for
		// a match again
		if nl += i; nl != i-1 && nl <= ret[0] {
			i = nl
			for i < len(sdata) && (sdata[i] == '\n' || sdata[i] == '\r') {
				i++
			}
			continue
		}
		n := pat.CreateNode(sdata, i, p, ret)
		rn.Append(n)
		i = n.Range.B
	}
	// handling unicode characters different length
	if len(sdata) != 0 {
		lut := make([]int, len(sdata)+1)
		j := 0
		for i := range sdata {
			lut[i] = j
			j++
		}
		lut[len(sdata)] = len(p.data)
		p.patch(lut, &rn)
	}
	if iter == 0 {
		panic("reached maximum number of iterations")
	}
	return &rn, nil
}
347320
func Parse(data string) (map[string]interface{}, error) {
	p, err := parse(data, "", false)
	if err != nil {
		return nil, err
	}
	return p.mapping, nil
}
1039751
func Parse(value string) (s Size, err error) {
	var (
		i    int
		r    rune
		num  float64
		unit string
	)

	for i, r = range value {
		if (r < '0' || r > '9') && r != '.' {
			break
		}
	}

	if num, err = strconv.ParseFloat(value[:i], 64); err != nil {
		return
	}

	unit = strings.TrimSpace(value[i:])
	switch unit {
	case "", "B":
		s = Size(num * B)
	case "K", "KB":
		s = Size(num * KB)
	case "M", "MB":
		s = Size(num * MB)
	case "G", "GB":
		s = Size(num * GB)
	case "T", "TB":
		s = Size(num * TB)
	case "P", "PB":
		s = Size(num * PB)
	case "E", "EB":
		s = Size(num * EB)
	default:
		err = errors.New("invalid value: " + value)
	}
	return
}
1111785
func Parse(value string) (time.Time, error) {
	for _, ds := range allDateStrings {
		if ds.Match(value) {
			return ds.Parse(value)
		}
	}
	return time.Time{}, &UnknownDateFormatError{value}
}
682065
func (p StringParser) Parse(field string) (result interface{}, err error) {
	return field, nil
}
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
}
115752
func (f *FlagSets) Parse(args []string) error {
	return f.mainSet.Parse(args)
}
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
}
106997
func (parser *myParser) Parse(s string) error {
	typ := reflect.TypeOf(parser.ptr)
	val := reflect.ValueOf(parser.ptr)
	if typ.Kind() == reflect.Ptr {
		kind := reflect.Indirect(val).Type().Kind()
		if kind == reflect.Struct {
			typElem, valElem := typ.Elem(), val.Elem()
			numField := valElem.NumField()
			for i := 0; i < numField; i++ {
				_, valField := typElem.Field(i), valElem.Field(i)
				if valField.Kind() == reflect.Int &&
					valField.CanSet() {
					valField.SetInt(2)
				}
				if valField.Kind() == reflect.String &&
					valField.CanSet() {
					valField.SetString("B")
				}
			}
		}
	}
	return nil
}
1359916
func parse(xlog xlog.Position) (res [2]int, err error) {
	parts := strings.SplitN(string(xlog), "/", 2)
	if len(parts) != 2 {
		err = fmt.Errorf("malformed xlog position %q", xlog)
		return
	}

	res[0], err = parseHex(parts[0])
	if err != nil {
		return
	}
	res[1], err = parseHex(parts[1])

	return
}
1167653
func (p *Parser) Parse() error {
	for {
		t, err := p.decoder.Token()
		if err == io.EOF {
			break
		} else if serr, ok := err.(*json.SyntaxError); ok {
			return WithStack(&ParseError{msg: err.Error(), Offset: serr.Offset})
		} else if err != nil {
			return WithStack(&ParseError{msg: err.Error()})
		}
		switch x := t.(type) {
		case nil:
			if err := p.builder.AddValue(NewNullValue()); err != nil {
				return WithStack(err)
			}
		case bool:
			if err := p.builder.AddValue(NewBoolValue(x)); err != nil {
				return WithStack(err)
			}
		case json.Number:
			if xu, err := strconv.ParseUint(string(x), 10, 64); err == nil {
				if err := p.builder.AddValue(NewUIntValue(xu)); err != nil {
					return WithStack(err)
				}
			} else if xi, err := x.Int64(); err == nil {
				if err := p.builder.AddValue(NewIntValue(xi)); err != nil {
					return WithStack(err)
				}
			} else {
				if xf, err := x.Float64(); err == nil {
					if err := p.builder.AddValue(NewDoubleValue(xf)); err != nil {
						return WithStack(err)
					}
				} else {
					return WithStack(&ParseError{msg: err.Error()})
				}
			}
		case string:
			if err := p.builder.AddValue(NewStringValue(x)); err != nil {
				return WithStack(err)
			}
		case json.Delim:
			switch x {
			case '[':
				if err := p.builder.OpenArray(p.options.BuildUnindexedArrays); err != nil {
					return WithStack(err)
				}
			case '{':
				if err := p.builder.OpenObject(p.options.BuildUnindexedObjects); err != nil {
					return WithStack(err)
				}
			case ']', '}':
				if err := p.builder.Close(); err != nil {
					return WithStack(err)
				}
			}
		}
	}
	return nil
}
1202307
func (urlMore *URLMore) Parse(rawurl string) error {
	myURL, err := url.Parse(rawurl)
	if err != nil {
		return err
	}
	urlMore.URL = myURL
	urlMore.Inflate()
	return nil
}
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
}
696124
func (parser *Parser) Parse(req *http.Request, params imageserver.Params) error {
	p := imageserver.Params{}
	err := parse(req, p)
	if err != nil {
		if err, ok := err.(*imageserver.ParamError); ok {
			err.Param = globalParam + "." + err.Param
		}
		return err
	}
	if !p.Empty() {
		params.Set(globalParam, p)
	}
	return nil
}
97337
func (s VersionStr) Parse() (Version, error) {
	raw, err := version.NewVersion(string(s))
	if err != nil {
		return Version{}, err
	}
	return Version{raw}, nil
}
731951
func Parse(line string) (*Log, error) {
	_, l, err := GuessParser(line)
	return l, err
}