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