summaryrefslogtreecommitdiff
path: root/vendor/github.com/alecthomas/chroma/v2/lexers/bash.go
blob: 1ea30f2dd5f0a8f8208e8c79275536f94e46c1ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
	})
}