mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-14 07:22:23 +00:00
8246efecce
Regex collation optimization for IsVendor now fails gracefully. Tests that are affected by non-RE2 syntax are explicitly marked.
22 lines
528 B
Cheetah
22 lines
528 B
Cheetah
package data
|
|
|
|
import "github.com/go-enry/go-enry/v2/regex"
|
|
|
|
{{define "mustCompile" -}}
|
|
{{ if isRE2 . -}}
|
|
regex.MustCompile({{ . | stringVal }})
|
|
{{- else -}}
|
|
regex.MustCompileRuby({{ . | stringVal }})
|
|
{{- end -}}
|
|
{{end}}
|
|
|
|
var VendorMatchers = []regex.EnryRegexp{
|
|
{{range $re := . -}}
|
|
{{ template "mustCompile" $re }},
|
|
{{end -}}
|
|
}
|
|
|
|
// FastVendorMatcher is equivalent to matching any of the VendorMatchers.
|
|
{{with $singleRE := collateAllRegexps . -}}
|
|
var FastVendorMatcher = {{template "mustCompile" $singleRE}}
|
|
{{end}} |