Mercurial > yakumo_izuru > aya
diff vendor/github.com/alecthomas/chroma/v2/lexers/bash.go @ 66:787b5ee0289d draft
Use vendored modules
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>
author | yakumo.izuru |
---|---|
date | Sun, 23 Jul 2023 13:18:53 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/github.com/alecthomas/chroma/v2/lexers/bash.go Sun Jul 23 13:18:53 2023 +0000 @@ -0,0 +1,17 @@ +package lexers + +import ( + "regexp" +) + +// TODO(moorereason): can this be factored away? +var bashAnalyserRe = regexp.MustCompile(`(?m)^#!.*/bin/(?:env |)(?:bash|zsh|sh|ksh)`) + +func init() { // nolint: gochecknoinits + Get("bash").SetAnalyser(func(text string) float32 { + if bashAnalyserRe.FindString(text) != "" { + return 1.0 + } + return 0.0 + }) +}