1// Package lexers contains the registry of all lexers.
2//
3// Sub-packages contain lexer implementations.
4package lexers
5
6// nolint
7import (
8	"github.com/alecthomas/chroma"
9	_ "github.com/alecthomas/chroma/lexers/a"
10	_ "github.com/alecthomas/chroma/lexers/b"
11	_ "github.com/alecthomas/chroma/lexers/c"
12	_ "github.com/alecthomas/chroma/lexers/circular"
13	_ "github.com/alecthomas/chroma/lexers/d"
14	_ "github.com/alecthomas/chroma/lexers/e"
15	_ "github.com/alecthomas/chroma/lexers/f"
16	_ "github.com/alecthomas/chroma/lexers/g"
17	_ "github.com/alecthomas/chroma/lexers/h"
18	_ "github.com/alecthomas/chroma/lexers/i"
19	"github.com/alecthomas/chroma/lexers/internal"
20	_ "github.com/alecthomas/chroma/lexers/j"
21	_ "github.com/alecthomas/chroma/lexers/k"
22	_ "github.com/alecthomas/chroma/lexers/l"
23	_ "github.com/alecthomas/chroma/lexers/m"
24	_ "github.com/alecthomas/chroma/lexers/n"
25	_ "github.com/alecthomas/chroma/lexers/o"
26	_ "github.com/alecthomas/chroma/lexers/p"
27	_ "github.com/alecthomas/chroma/lexers/q"
28	_ "github.com/alecthomas/chroma/lexers/r"
29	_ "github.com/alecthomas/chroma/lexers/s"
30	_ "github.com/alecthomas/chroma/lexers/t"
31	_ "github.com/alecthomas/chroma/lexers/v"
32	_ "github.com/alecthomas/chroma/lexers/w"
33	_ "github.com/alecthomas/chroma/lexers/x"
34	_ "github.com/alecthomas/chroma/lexers/y"
35	_ "github.com/alecthomas/chroma/lexers/z"
36)
37
38// Registry of Lexers.
39var Registry = internal.Registry
40
41// Names of all lexers, optionally including aliases.
42func Names(withAliases bool) []string { return internal.Names(withAliases) }
43
44// Get a Lexer by name, alias or file extension.
45func Get(name string) chroma.Lexer { return internal.Get(name) }
46
47// MatchMimeType attempts to find a lexer for the given MIME type.
48func MatchMimeType(mimeType string) chroma.Lexer { return internal.MatchMimeType(mimeType) }
49
50// Match returns the first lexer matching filename.
51func Match(filename string) chroma.Lexer { return internal.Match(filename) }
52
53// Analyse text content and return the "best" lexer..
54func Analyse(text string) chroma.Lexer { return internal.Analyse(text) }
55
56// Register a Lexer with the global registry.
57func Register(lexer chroma.Lexer) chroma.Lexer { return internal.Register(lexer) }
58
59// Fallback lexer if no other is found.
60var Fallback = internal.Fallback
61