mirror of
https://github.com/alecthomas/chroma.git
synced 2025-03-19 21:10:15 +02:00
regexp2 uses number of group as its name so name check isn't needed
This commit is contained in:
parent
1b7d2dd620
commit
2e23e7f215
@ -504,11 +504,9 @@ func matchRules(text []rune, pos int, rules []*CompiledRule) (int, *CompiledRule
|
||||
match, err := rule.Regexp.FindRunesMatchStartingAt(text, pos)
|
||||
if match != nil && err == nil && match.Index == pos {
|
||||
groups := []string{}
|
||||
namedGroups := map[string]string{}
|
||||
namedGroups := make(map[string]string)
|
||||
for _, g := range match.Groups() {
|
||||
if g.Name != `` {
|
||||
namedGroups[g.Name] = g.String()
|
||||
}
|
||||
groups = append(groups, g.String())
|
||||
}
|
||||
return i, rule, groups, namedGroups
|
||||
|
Loading…
x
Reference in New Issue
Block a user