// parse runs the left recursive descending algorithm
// on input string. It returns a list of map[key]value.
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)
		}
	}
}
497657
func Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
	return new(Parser).Parse(tokenString, keyFunc)
}
1336764
func (c Config) Parse(s string) error {
	c.file = "<string>"
	c.input = s
	return c.parse()
}
10348
func (parser StringTypeParser) Parse(d DataType) error {
	if value, ok := AsString(d); ok {
		parser.setter(value)
	} else {
		return fmt.Errorf("Error parsing type of %#v as a String", d)
	}
	return nil
}
641373
func Parse(text string) (*Tree, error) {
	tree := &Tree{}
	if text == "" {
		tree.Tree = &parse.Tree{}
		return tree, nil
	}
	var err error
	tree.Tree, err = parse.Parse(text)
	return tree, err
}
659074
func Parse(doc string, argv []string, help bool, version string, optionsFirst bool, exit ...bool) (map[string]interface{}, error) {
	exitOk := true
	if len(exit) > 0 {
		exitOk = exit[0]
	}
	p := &Parser{
		OptionsFirst:  optionsFirst,
		SkipHelpFlags: !help,
	}
	if exitOk {
		p.HelpHandler = PrintHelpAndExit
	} else {
		p.HelpHandler = PrintHelpOnly
	}
	return p.parse(doc, argv, version)
}
1257841
func Parse(val string) IntOrString {
	i, err := strconv.Atoi(val)
	if err != nil {
		return FromString(val)
	}
	return FromInt(i)
}
787113
func (t *tree) parse() (_ Node, err error) {
	defer func() {
		if p := recover(); p != nil {
			err = fmt.Errorf("parse error: %v", p)
		}
	}()
	return t.O(0), err
}
395668
func (t *Trie) Parse(pattern string) *Node {
	if strings.Contains(pattern, "//") {
		panic(fmt.Errorf(`multi-slash exist: "%s"`, pattern))
	}
	_pattern := strings.TrimPrefix(pattern, "/")
	if !t.caseSensitive {
		_pattern = strings.ToLower(_pattern)
	}
	node := parsePattern(t.root, strings.Split(_pattern, "/"))
	if node.pattern == "" {
		node.pattern = pattern
	}
	return node
}
1221937
func Parse(v interface{}) ([]string, error) {
	if command, _, err := generateCommand(v, true); err == nil {
		return command, err
	} else {
		return nil, err
	}
}
322916
func (m *ChannelMap) Parse(s string) {
	cstr := C.CString(s)
	defer C.free(unsafe.Pointer(cstr))
	m.fromC(C.pa_channel_map_parse(m.toC(), cstr))
}
563790
func Parse(s string) (time.Time, error) {
	d, _, err := ParseAndGetLayout(s)
	return d, err
}
629776
func parse(s string) (string, string) {
	if s == "/" {
		return s, ""
	}
	for i := 1; i < len(s); i++ {
		if s[i] == '/' {
			return s[0:i], s[i:]
		}
	}

	return s, ""
}
1353814
func Parse(in io.Reader) (config Config, err error) {
	dec := yaml.NewDecoder(in)
	dec.SetStrict(true)
	if err = dec.Decode(&config); err != nil {
		return
	}

	config.Info.Version = os.ExpandEnv(config.Info.Version)
	err = config.Validate()
	return
}
514080
func Parse(err string) *Error {
	e := new(Error)
	errr := json.Unmarshal([]byte(err), e)
	if errr != nil {
		e.Detail = err
	}
	return e
}
777377
func (t *ParseTree) Parse(p *Parser) (Statement, error) {
	for {
		tok, pos, lit := p.ScanIgnoreWhitespace()
		if subtree := t.Tokens[tok]; subtree != nil {
			t = subtree
			continue
		}

		if stmt := t.Handlers[tok]; stmt != nil {
			return stmt(p)
		}

		// There were no registered handlers. Return the valid tokens in the order they were added.
		return nil, newParseError(tokstr(tok, lit), t.Keys, pos)
	}
}
1164845
func Parse(exp *string) (criteria.Expression, error) {
	if exp == nil || len(*exp) == 0 {
		return criteria.Literal(true), nil
	}
	var unmarshalled map[string]interface{}
	err := json.Unmarshal([]byte(*exp), &unmarshalled)
	if err != nil {
		return nil, errors.WithStack(err)
	}
	var result *criteria.Expression
	if len(unmarshalled) > 0 {
		for key, value := range unmarshalled {
			current := criteria.Equals(criteria.Field(key), criteria.Literal(value))
			if result == nil {
				result = &current
			} else {
				current = criteria.And(*result, current)
				result = &current
			}
		}
		return *result, nil
	}
	return criteria.Literal(true), nil
}