1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-09 13:23:51 +02:00
chroma/lexers/dns.go
Mubashshir 5ce1d5dd69 lexers: Add BIND DNS Zone lexer
Closes #623
Signed-off-by: Mubashshir <ahmubashshir@gmail.com>
2022-06-27 01:18:15 -07:00

18 lines
326 B
Go

package lexers
import (
"regexp"
)
// TODO(moorereason): can this be factored away?
var zoneAnalyserRe = regexp.MustCompile(`(?m)^@\s+IN\s+SOA\s+`)
func init() { // nolint: gochecknoinits
Get("dns").SetAnalyser(func(text string) float32 {
if zoneAnalyserRe.FindString(text) != "" {
return 1.0
}
return 0.0
})
}