chroma-markdown/vendor/github.com/alecthomas/chroma/lexers/d/diff.go

30 lines
674 B
Go
Raw Normal View History

package d
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
)
// Diff lexer.
var Diff = internal.Register(MustNewLexer(
2017-10-22 05:37:38 +02:00
&Config{
Name: "Diff",
Aliases: []string{"diff", "udiff"},
2018-01-06 23:02:24 +01:00
EnsureNL: true,
2017-10-22 05:37:38 +02:00
Filenames: []string{"*.diff", "*.patch"},
MimeTypes: []string{"text/x-diff", "text/x-patch"},
},
Rules{
"root": {
{` .*\n`, Text, nil},
{`\+.*\n`, GenericInserted, nil},
{`-.*\n`, GenericDeleted, nil},
{`!.*\n`, GenericStrong, nil},
{`@.*\n`, GenericSubheading, nil},
{`([Ii]ndex|diff).*\n`, GenericHeading, nil},
{`=.*\n`, GenericHeading, nil},
{`.*\n`, Text, nil},
},
},
))