// Parse for Parser interface
548441
func (ap *Apache) Parse(line string) (*Log, error) {
	matches := logRe.FindStringSubmatch(line)
	if len(matches) < 1 {
		return nil, fmt.Errorf("failed to parse apachelog (not matched): %s", line)
	}
	l := &Log{
		VirtualHost:   matches[1],
		Host:          matches[2],
		RemoteLogname: matches[3],
		User:          matches[4],
	}
	if l.Host == "-" && l.VirtualHost != "" {
		l.Host = l.VirtualHost
		l.VirtualHost = ""
		l.User = fmt.Sprintf("%s %s", l.RemoteLogname, l.User)
		l.RemoteLogname = "-"
	}

	l.Time, _ = time.Parse(clfTimeLayout, matches[5])
	var rest string

	l.Request, rest = takeQuoted(matches[6])
	if err := l.breakdownRequest(); err != nil {
		return nil, errors.Wrapf(err, "failed to parse apachelog (invalid request): %s", line)
	}
	matches = strings.Fields(rest)
	if len(matches) < 2 {
		return nil, fmt.Errorf("failed to parse apachelog (invalid status or size): %s", line)
	}
	l.Status, _ = strconv.Atoi(matches[0])
	if l.Status < 100 || 600 <= l.Status {
		return nil, fmt.Errorf("failed to parse apachelog (invalid status: %s): %s", matches[0], line)
	}
	l.Size, _ = strconv.ParseUint(matches[1], 10, 64)
	l.Referer, rest = takeQuoted(rest)
	l.UserAgent, _ = takeQuoted(rest)
	return l, nil
}
1124616
func Parse(filename string, src io.Reader) (Grammar, error) {
	var p parser
	grammar := p.parse(filename, src)
	return grammar, p.errors.Err()
}
7505
func (p *Parser) parse() (map[string]string, error) {
	p.scan() // init scannedItems

	labelsMap := map[string]string{}
	for {
		tok, lit := p.lookahead()
		switch tok {
		case IdentifierToken:
			key, value, err := p.parseLabel()
			if err != nil {
				return nil, fmt.Errorf("unable to parse requirement: %v", err)
			}
			labelsMap[key] = value
			t, l := p.consume()
			switch t {
			case EndOfStringToken:
				return labelsMap, nil
			case CommaToken:
				t2, l2 := p.lookahead()
				if t2 != IdentifierToken {
					return nil, fmt.Errorf("found '%s', expected: identifier after ','", l2)
				}
			default:
				return nil, fmt.Errorf("found '%s', expected: ',' or 'end of string'", l)
			}
		case EndOfStringToken:
			return labelsMap, nil
		default:
			return nil, fmt.Errorf("found '%s', expected: identifier or 'end of string'", lit)
		}
	}
}
928956
func Parse(args []string, argv interface{}) error {
	clr := color.Color{}
	fset := parseArgv(args, argv, clr)
	return fset.err
}
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
}
1069702
func (lp ListParser) Parse(req *http.Request, params imageserver.Params) error {
	for _, subParser := range lp {
		err := subParser.Parse(req, params)
		if err != nil {
			return err
		}
	}
	return nil
}
416025
func Parse(tokens []*lexer.Token, params Params) (*fsm.State, error) {
	p := &parser{
		spec:       params.Spec,
		options:    params.Options,
		optionsIdx: params.OptionsIdx,
		args:       params.Args,
		argsIdx:    params.ArgsIdx,
		tokens:     tokens,
	}
	return p.parse()
}
140898
func (t *Tree) Parse(text string) (err error) {
	defer t.recover(&err)
	t.startParse(lex(text))
	t.Text = text
	t.parse()
	t.stopParse()
	return nil
}
946257
func Parse(parser, obj interface{}) {
	parsers := Parsers{}

	if p, ok := parser.(StringParser); ok {
		parsers.StringParser = p
	}
	if p, ok := parser.(IntParser); ok {
		parsers.IntParser = p
	}
	if p, ok := parser.(FloatParser); ok {
		parsers.FloatParser = p
	}

	parseRecursive(parsers, reflect.ValueOf(obj))
}
799769
func Parse(r io.Reader) (*Program, error) {
	program := &Program{}
	err := basicParser.Parse(r, program)
	if err != nil {
		return nil, err
	}
	program.init()
	return program, 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)
}
121205
func (p *parser) parse() ([]node, error) {
	var nodes []node
loop:
	for {
		token := p.read()
		switch token.typ {
		case tokenEOF:
			break loop
		case tokenError:
			return nil, p.errorf(token, "%s", token.val)
		case tokenText:
			nodes = append(nodes, textNode(token.val))
		case tokenLeftDelim:
			node, err := p.parseTag()
			if err != nil {
				return nodes, err
			}
			nodes = append(nodes, node)
		case tokenRawStart:
			node, err := p.parseRawTag()
			if err != nil {
				return nodes, err
			}
			nodes = append(nodes, node)
		case tokenSetDelim:
			nodes = append(nodes, new(delimNode))
		}
	}
	return nodes, nil
}
1201755
func (d *DateString) Parse(value string) (time.Time, error) {
	return time.Parse(d.Layout, value)
}
1314068
func (parser *QualityParser) Parse(req *http.Request, params imageserver.Params) error {
	return imageserver_http.ParseQueryInt("quality", req, params)
}
1062848
func (rp *Parser) Parse(feed io.Reader) (*Feed, error) {
	p := xpp.NewXMLPullParser(feed, false, shared.NewReaderLabel)
	rp.base = &shared.XMLBase{}

	_, err := rp.base.FindRoot(p)
	if err != nil {
		return nil, err
	}

	return rp.parseRoot(p)
}
355538
func (parser *FormatParser) Parse(req *http.Request, params imageserver.Params) error {
	imageserver_http.ParseQueryString("format", req, params)
	if !params.Has("format") {
		return nil
	}
	format, err := params.GetString("format")
	if err != nil {
		return err
	}
	if format == "jpg" {
		format = "jpeg"
	}
	params.Set("format", format)
	return nil
}
248036
func (f *Flaeg) Parse(cmd *Command) (*Command, error) {
	if f.calledCommand == nil {
		f.commandArgs = f.args
	}

	if err := LoadWithCommand(cmd, f.commandArgs, f.customParsers, f.commands); err != nil {
		return cmd, err
	}
	return cmd, nil
}