chroma-markdown/vendor/github.com/alecthomas/chroma/lexers/i/ini.go

26 lines
625 B
Go
Raw Normal View History

package i
2017-10-22 05:37:38 +02:00
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
2017-10-22 05:37:38 +02:00
)
// Ini lexer.
var Ini = internal.Register(MustNewLexer(
2017-10-22 05:37:38 +02:00
&Config{
Name: "INI",
Aliases: []string{"ini", "cfg", "dosini"},
Filenames: []string{"*.ini", "*.cfg", "*.inf"},
MimeTypes: []string{"text/x-ini", "text/inf"},
},
Rules{
"root": {
{`\s+`, Text, nil},
{`[;#].*`, CommentSingle, nil},
{`\[.*?\]$`, Keyword, nil},
{`(.*?)([ \t]*)(=)([ \t]*)(.*(?:\n[ \t].+)*)`, ByGroups(NameAttribute, Text, Operator, Text, LiteralString), nil},
{`(.+?)$`, NameAttribute, nil},
},
},
))