mirror of
https://github.com/alecthomas/chroma.git
synced 2026-05-22 10:15:46 +02:00
Initial commit! Working!
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package lexers
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
)
|
||||
|
||||
var INI = Register(NewLexer(
|
||||
&Config{
|
||||
Name: "INI",
|
||||
Aliases: []string{"ini", "cfg", "dosini"},
|
||||
Filenames: []string{"*.ini", "*.cfg", "*.inf"},
|
||||
MimeTypes: []string{"text/x-ini", "text/inf"},
|
||||
},
|
||||
map[string][]Rule{
|
||||
"root": []Rule{
|
||||
{`\s+`, Whitespace, nil},
|
||||
{`;.*?$`, Comment, nil},
|
||||
{`\[.*?\]$`, Keyword, nil},
|
||||
{`(.*?)(\s*)(=)(\s*)(.*?)$`, ByGroups(Name, Whitespace, Operator, Whitespace, String), nil},
|
||||
// standalone option, supported by some INI parsers
|
||||
{`(.+?)$`, NameAttribute, nil},
|
||||
},
|
||||
},
|
||||
))
|
||||
Reference in New Issue
Block a user