1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-21 19:06:18 +02:00
chroma/lexers/xorg.go
Alec Thomas a10fd0a23d Switch to github.com/dlclark/regexp2.
This makes translating Pygments lexers much much simpler (and possible).
2017-09-18 11:16:44 +10:00

25 lines
584 B
Go

package lexers
import (
. "github.com/alecthomas/chroma" // nolint
)
// Xorg lexer.
var Xorg = Register(MustNewLexer(
&Config{
Name: "Xorg",
Aliases: []string{"xorg.conf"},
Filenames: []string{"xorg.conf"},
MimeTypes: []string{},
},
Rules{
"root": {
{`\s+`, Text, nil},
{`#.*$`, Comment, nil},
{`((|Sub)Section)(\s+)("\w+")`, ByGroups(LiteralStringEscape, LiteralStringEscape, Text, LiteralStringEscape), nil},
{`(End(|Sub)Section)`, LiteralStringEscape, nil},
{`(\w+)(\s+)([^\n#]+)`, ByGroups(NameBuiltin, Text, NameConstant), nil},
},
},
))