1
0
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:
Alec Thomas
2017-06-02 00:17:21 +10:00
parent 3de978543f
commit b2fb8edf77
16 changed files with 962 additions and 0 deletions
+24
View File
@@ -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},
},
},
))