1
0
mirror of https://gitea.com/Sirherobrine23/tea.git synced 2024-08-21 19:07:24 +00:00
tea/vendor/github.com/alecthomas/chroma/lexers/a/apache.go
Norwin d6df0a53b5 Update Dependencies (#390)
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>
2021-08-30 23:18:50 +08:00

43 lines
1.3 KiB
Go

package a
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Apacheconf lexer.
var Apacheconf = internal.Register(MustNewLazyLexer(
&Config{
Name: "ApacheConf",
Aliases: []string{"apacheconf", "aconf", "apache"},
Filenames: []string{".htaccess", "apache.conf", "apache2.conf"},
MimeTypes: []string{"text/x-apacheconf"},
CaseInsensitive: true,
},
apacheconfRules,
))
func apacheconfRules() Rules {
return Rules{
"root": {
{`\s+`, Text, nil},
{`(#.*?)$`, Comment, nil},
{`(<[^\s>]+)(?:(\s+)(.*?))?(>)`, ByGroups(NameTag, Text, LiteralString, NameTag), nil},
{`([a-z]\w*)(\s+)`, ByGroups(NameBuiltin, Text), Push("value")},
{`\.+`, Text, nil},
},
"value": {
{`\\\n`, Text, nil},
{`$`, Text, Pop(1)},
{`\\`, Text, nil},
{`[^\S\n]+`, Text, nil},
{`\d+\.\d+\.\d+\.\d+(?:/\d+)?`, LiteralNumber, nil},
{`\d+`, LiteralNumber, nil},
{`/([a-z0-9][\w./-]+)`, LiteralStringOther, nil},
{`(on|off|none|any|all|double|email|dns|min|minimal|os|productonly|full|emerg|alert|crit|error|warn|notice|info|debug|registry|script|inetd|standalone|user|group)\b`, Keyword, nil},
{`"([^"\\]*(?:\\.[^"\\]*)*)"`, LiteralStringDouble, nil},
{`[^\s"\\]+`, Text, nil},
},
}
}