xorg.go

 1package x
 2
 3import (
 4	. "github.com/alecthomas/chroma" // nolint
 5	"github.com/alecthomas/chroma/lexers/internal"
 6)
 7
 8// Xorg lexer.
 9var Xorg = internal.Register(MustNewLexer(
10	&Config{
11		Name:      "Xorg",
12		Aliases:   []string{"xorg.conf"},
13		Filenames: []string{"xorg.conf"},
14		MimeTypes: []string{},
15	},
16	Rules{
17		"root": {
18			{`\s+`, TextWhitespace, nil},
19			{`#.*$`, Comment, nil},
20			{`((|Sub)Section)(\s+)("\w+")`, ByGroups(KeywordNamespace, LiteralStringEscape, TextWhitespace, LiteralStringEscape), nil},
21			{`(End(|Sub)Section)`, KeywordNamespace, nil},
22			{`(\w+)(\s+)([^\n#]+)`, ByGroups(NameKeyword, TextWhitespace, LiteralString), nil},
23		},
24	},
25))