mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-26 20:41:35 +01:00
d6df0a53b5
Co-authored-by: Norwin Roosen <git@nroo.de> Co-authored-by: Norwin <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/390 Reviewed-by: 6543 <6543@obermui.de> Reviewed-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
30 lines
711 B
Go
30 lines
711 B
Go
package x
|
|
|
|
import (
|
|
. "github.com/alecthomas/chroma" // nolint
|
|
"github.com/alecthomas/chroma/lexers/internal"
|
|
)
|
|
|
|
// Xorg lexer.
|
|
var Xorg = internal.Register(MustNewLazyLexer(
|
|
&Config{
|
|
Name: "Xorg",
|
|
Aliases: []string{"xorg.conf"},
|
|
Filenames: []string{"xorg.conf"},
|
|
MimeTypes: []string{},
|
|
},
|
|
xorgRules,
|
|
))
|
|
|
|
func xorgRules() Rules {
|
|
return Rules{
|
|
"root": {
|
|
{`\s+`, TextWhitespace, nil},
|
|
{`#.*$`, Comment, nil},
|
|
{`((|Sub)Section)(\s+)("\w+")`, ByGroups(KeywordNamespace, LiteralStringEscape, TextWhitespace, LiteralStringEscape), nil},
|
|
{`(End(|Sub)Section)`, KeywordNamespace, nil},
|
|
{`(\w+)(\s+)([^\n#]+)`, ByGroups(NameKeyword, TextWhitespace, LiteralString), nil},
|
|
},
|
|
}
|
|
}
|