2017-06-08 10:28:36 +00:00
|
|
|
package data
|
2017-04-05 14:01:31 +00:00
|
|
|
|
2017-06-08 07:27:27 +00:00
|
|
|
// CODE GENERATED AUTOMATICALLY WITH gopkg.in/src-d/enry.v1/internal/code-generator
|
2017-04-05 14:01:31 +00:00
|
|
|
// THIS FILE SHOULD NOT BE EDITED BY HAND
|
|
|
|
// Extracted from github/linguist commit: {{ getCommit }}
|
|
|
|
|
2017-06-21 07:58:33 +00:00
|
|
|
import "gopkg.in/toqueteos/substring.v1"
|
2017-04-05 14:01:31 +00:00
|
|
|
|
2017-05-31 10:07:46 +00:00
|
|
|
type languageMatcher func ([]byte) []string
|
2017-04-05 14:01:31 +00:00
|
|
|
|
2017-06-08 10:28:36 +00:00
|
|
|
var ContentMatchers = map[string]languageMatcher{
|
2017-04-05 14:01:31 +00:00
|
|
|
{{ range $index, $disambiguator := . -}}
|
2017-05-31 10:07:46 +00:00
|
|
|
{{ printf "%q" $disambiguator.Extension }}: func(i []byte) []string {
|
2017-04-05 14:01:31 +00:00
|
|
|
{{ range $i, $language := $disambiguator.Languages -}}
|
|
|
|
|
|
|
|
{{- if not (avoidLanguage $language) }}
|
|
|
|
{{- if gt (len $language.Heuristics) 0 }}
|
2017-06-21 07:58:33 +00:00
|
|
|
{{- if gt $i 0 }} else {{ end -}}
|
|
|
|
if {{- range $j, $heuristic := $language.Heuristics }} {{ $heuristic.Name }}.Match(string(i))
|
2017-04-05 14:01:31 +00:00
|
|
|
{{- if lt $j (len $language.LogicRelations) }} {{index $language.LogicRelations $j}} {{- end -}} {{ end }} {
|
2017-05-31 10:07:46 +00:00
|
|
|
return []string{ {{- printf "%q" $language.Language -}} }
|
2017-04-05 14:01:31 +00:00
|
|
|
}
|
2017-06-08 10:28:36 +00:00
|
|
|
|
2017-04-05 14:01:31 +00:00
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end}}
|
2017-06-08 10:28:36 +00:00
|
|
|
|
2017-05-31 10:07:46 +00:00
|
|
|
return {{ returnLanguages $disambiguator.Languages | returnStringSlice }}
|
2017-04-05 14:01:31 +00:00
|
|
|
},
|
|
|
|
{{ end -}}
|
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
|
|
{{ range $index, $heuristic := getAllHeuristics . -}}
|
2017-06-21 07:58:33 +00:00
|
|
|
{{ $heuristic.Name }} = substring.Regexp(`{{ $heuristic.Regexp }}`)
|
2017-04-05 14:01:31 +00:00
|
|
|
{{ end -}}
|
2017-06-08 10:28:36 +00:00
|
|
|
)
|