1package p
2
3import (
4 . "github.com/alecthomas/chroma" // nolint
5 "github.com/alecthomas/chroma/lexers/internal"
6)
7
8// Pkgconfig lexer.
9var Pkgconfig = internal.Register(MustNewLexer(
10 &Config{
11 Name: "PkgConfig",
12 Aliases: []string{"pkgconfig"},
13 Filenames: []string{"*.pc"},
14 MimeTypes: []string{},
15 },
16 Rules{
17 "root": {
18 {`#.*$`, CommentSingle, nil},
19 {`^(\w+)(=)`, ByGroups(NameAttribute, Operator), nil},
20 {`^([\w.]+)(:)`, ByGroups(NameTag, Punctuation), Push("spvalue")},
21 Include("interp"),
22 {`[^${}#=:\n.]+`, Text, nil},
23 {`.`, Text, nil},
24 },
25 "interp": {
26 {`\$\$`, Text, nil},
27 {`\$\{`, LiteralStringInterpol, Push("curly")},
28 },
29 "curly": {
30 {`\}`, LiteralStringInterpol, Pop(1)},
31 {`\w+`, NameAttribute, nil},
32 },
33 "spvalue": {
34 Include("interp"),
35 {`#.*$`, CommentSingle, Pop(1)},
36 {`\n`, Text, Pop(1)},
37 {`[^${}#\n]+`, Text, nil},
38 {`.`, Text, nil},
39 },
40 },
41))