parser.go
func parseMatcher(pat string) (matcher Matcher, name string) {
	if !isMatchPattern(pat) {
		panic("pattern \"" + pat + "\" is not a matcher pattern")
	}

	s := pat[1 : len(pat)-1]
	ss := strings.Split(s, ":")
	var matchType string
	if len(ss) == 1 {
		name = ss[0]
	} else {
		matchType = ss[0]
		name = ss[1]
	}
	if matchType == "" {
		matchType = "default"
	}

	matcher = MatcherMap[matchType]
	if matcher == nil {
		panic(errors.New("no such match type: " + matchType))
	}

	return matcher, name
}
func parseMatcher(pat string) (matcher Matcher, name string) {
	if !isMatchPattern(pat) {
		panic("pattern \"" + pat + "\" is not a matcher pattern")
	}

	s := pat[1 : len(pat)-1]
	ss := strings.Split(s, ":")
	var matchType string
	if len(ss) == 1 {
		name = ss[0]
	} else {
		matchType = ss[0]
		name = ss[1]
	}
	if matchType == "" {
		matchType = "default"
	}

	matcher = MatcherMap[matchType]
	if matcher == nil {
		panic(errors.New("no such match type: " + matchType))
	}

	return matcher, name
}
func parseMatcher ( pat string ) ( matcher Matcher , name string ) { if ! isMatchPattern ( pat ) { panic ( " \" " + pat + " \" " ) } s := pat [ 1 : len ( pat ) - 1 ] ss := strings . Split ( s , " " ) var matchType string if len ( ss ) == 1 { name = ss [ 0 ] } else { matchType = ss [ 0 ] name = ss [ 1 ] } if matchType == " " { matchType = " " } matcher = MatcherMap [ matchType ] if matcher == nil { panic ( errors . New ( " " + matchType ) ) } return matcher , name }
// parseMatcher returns matcher and name from the given pattern string.
parseMatcher returns matcher and name from the given pattern string .