mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
more review feedback
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
This commit is contained in:
parent
9733377257
commit
969497c5a3
|
@ -76,8 +76,8 @@ func findSetMatches(re *syntax.Regexp, base string) []string {
|
||||||
case syntax.OpConcat:
|
case syntax.OpConcat:
|
||||||
return findSetMatchesFromConcat(re, base)
|
return findSetMatchesFromConcat(re, base)
|
||||||
case syntax.OpCharClass:
|
case syntax.OpCharClass:
|
||||||
if len(re.Rune) == 1 {
|
if len(re.Rune)%2 != 0 {
|
||||||
return []string{base + string(re.Rune)}
|
return nil
|
||||||
}
|
}
|
||||||
var matches []string
|
var matches []string
|
||||||
var totalSet int
|
var totalSet int
|
||||||
|
@ -105,20 +105,14 @@ func findSetMatches(re *syntax.Regexp, base string) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func findSetMatchesFromConcat(re *syntax.Regexp, base string) []string {
|
func findSetMatchesFromConcat(re *syntax.Regexp, base string) []string {
|
||||||
if isCaseInsensitive(re) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if len(re.Sub) == 0 {
|
if len(re.Sub) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
clearBeginEndText(re)
|
clearBeginEndText(re)
|
||||||
clearCapture(re.Sub...)
|
clearCapture(re.Sub...)
|
||||||
matches := findSetMatches(re.Sub[0], base)
|
matches := []string{base}
|
||||||
if matches == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := 1; i < len(re.Sub); i++ {
|
for i := 0; i < len(re.Sub); i++ {
|
||||||
var newMatches []string
|
var newMatches []string
|
||||||
for _, b := range matches {
|
for _, b := range matches {
|
||||||
m := findSetMatches(re.Sub[i], b)
|
m := findSetMatches(re.Sub[i], b)
|
||||||
|
|
Loading…
Reference in a new issue