1package t
2
3import (
4 . "github.com/alecthomas/chroma" // nolint
5 "github.com/alecthomas/chroma/lexers/internal"
6)
7
8var TOML = internal.Register(MustNewLexer(
9 &Config{
10 Name: "TOML",
11 Aliases: []string{"toml"},
12 Filenames: []string{"*.toml"},
13 MimeTypes: []string{"text/x-toml"},
14 },
15 Rules{
16 "root": {
17 {`\s+`, Text, nil},
18 {`#.*`, Comment, nil},
19 {Words(``, `\b`, `true`, `false`), KeywordConstant, nil},
20 {`\d\d\d\d-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d\+)?(Z|[+-]\d{2}:\d{2})`, LiteralDate, nil},
21 {`[+-]?[0-9](_?\d)*\.\d+`, LiteralNumberFloat, nil},
22 {`[+-]?[0-9](_?\d)*`, LiteralNumberInteger, nil},
23 {`"(\\\\|\\"|[^"])*"`, StringDouble, nil},
24 {`'(\\\\|\\'|[^'])*'`, StringSingle, nil},
25 {`[.,=\[\]]`, Punctuation, nil},
26 {`[^\W\d]\w*`, NameOther, nil},
27 },
28 },
29))