// Parse converts a pretty printed predicate into a predicate.
168473
func Parse(s string) (*Predicate, error) {
	raw := strings.TrimSpace(s)
	if raw == "" {
		return nil, fmt.Errorf("predicate.Parse cannot create predicate from empty string %q", s)
	}
	if raw[0] != '"' {
		return nil, fmt.Errorf("predicate.Parse failed to parse since string does not start with \" in %s", s)
	}
	idx := strings.Index(raw, "\"@[")
	if idx < 0 {
		return nil, fmt.Errorf("predicate.Parse could not find anchor definition in %s", raw)
	}
	id, ta := raw[0:idx+1], raw[idx+3:len(raw)-1]
	id, err := strconv.Unquote(id)
	if err != nil {
		return nil, fmt.Errorf("predicate.Parse can't unquote id in %s: %v", raw, err)
	}
	// TODO: if id has \" inside, it should be unquoted.
	if ta == "" {
		return &Predicate{
			id: ID(id),
		}, nil
	}
	if ta[0] == '"' {
		ta = ta[1:]
	}
	if ta[len(ta)-1] == '"' {
		ta = ta[:len(ta)-1]
	}
	pta, err := time.Parse(time.RFC3339Nano, ta)
	if err != nil {
		return nil, fmt.Errorf("predicate.Parse failed to parse time anchor %s in %s with error %v", ta, raw, err)
	}
	return &Predicate{
		id:     ID(id),
		anchor: &pta,
	}, nil
}
769511
func Parse(s *Scanner) (ast.Stmt, error) {
	l := Lexer{s: s}
	if yyParse(&l) != 0 {
		return nil, l.e
	}
	return l.stmt, l.e
}
536133
func (parser FloatTypeParser) Parse(d DataType) error {
	if value, ok := AsFloat(d); ok {
		parser.setter(value)
	} else {
		return fmt.Errorf("Error parsing type of %#v as a Float", d)
	}
	return nil
}
440519
func (element *DxfParseable) Parse(tags TagSlice) error {
	for _, tag := range tags.RegularTags() {
		if parser, ok := element.tagParsers[tag.Code]; ok {
			err := parser.Parse(tag.Value)
			if err != nil {
				return err
			}
		} else {
			Log.Printf("Discarding tag: %+v\n", tag.ToString())
		}
	}
	return nil
}
985658
func (s ConstraintStr) Parse() (Constraints, error) {
	raw, err := version.NewConstraint(string(s))
	if err != nil {
		return Constraints{}, err
	}
	return Constraints{raw}, nil
}
683891
func parse(expr string) node {
	r := &scanner{text: expr}
	r.nextChar()
	r.nextItem()
	p := &parser{r: r}
	return p.parseExpression(nil)
}
572998
func (tpl *Template) parse() error {
	if tpl.program == nil {
		var err error

		tpl.program, err = parser.Parse(tpl.source)
		if err != nil {
			return err
		}
	}

	return nil
}
822599
func Parse(record string) ([]string, error) {
	reader := csv.NewReader(strings.NewReader(record))
	result, err := reader.Read()
	if err != nil {
		return nil, err
	}
	return result, nil
}
695042
func (ep EnumParser) Parse(s string) (interface{}, error) {
	if !ep.CaseMatch {
		s = strings.ToLower(s)
	}
	v, ok := ep.vals[s]
	if !ok {
		return false, fmt.Errorf("failed to parse %s %#q", ep.Type, s)
	}
	return v, nil
}
1124616
func Parse(filename string, src io.Reader) (Grammar, error) {
	var p parser
	grammar := p.parse(filename, src)
	return grammar, p.errors.Err()
}
1102249
func (s *HTTPServer) parse(resp http.ResponseWriter, req *http.Request, r *string, b *structs.QueryOptions) bool {
	s.parseRegion(req, r)
	s.parseToken(req, &b.AuthToken)
	parseConsistency(req, b)
	parsePrefix(req, b)
	parseNamespace(req, &b.Namespace)
	return parseWait(resp, req, b)
}
474365
func Parse(s []byte) (*ast.Program, error) {
	lex := newLexer(s)
	e := yyParse(lex)
	if e == 0 && !lex.parseFailed {
		return lex.program, nil
	}
	return nil, lex.err
}
735846
func Parse(v interface{}) error {
	globalFlagSet = NewFlagSet(filepath.Base(os.Args[0]), v)
	return globalFlagSet.Parse(os.Args[1:])
}
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
}
986135
func (p *Parser) Parse(data []byte) (interfaces.Mappable, error) {
	var feed Feed

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

	return feed, nil
}
45479
func (p *parserImpl) parse(
	blob json.RawMessage,
) ([]*Comment, []*Post, []*Message, error) {
	comments, posts, msgs, listingErr := parseRawListing(blob)
	if listingErr == nil {
		return comments, posts, msgs, nil
	}

	post, threadErr := parseThread(blob)
	if threadErr == nil {
		return nil, []*Post{post}, nil, nil
	}

	return nil, nil, nil, fmt.Errorf(
		"failed to parse as listing [%v] or thread [%v]",
		listingErr, threadErr,
	)
}
928956
func Parse(args []string, argv interface{}) error {
	clr := color.Color{}
	fset := parseArgv(args, argv, clr)
	return fset.err
}