bnf.go

 1package b
 2
 3import (
 4	. "github.com/alecthomas/chroma" // nolint
 5	"github.com/alecthomas/chroma/lexers/internal"
 6)
 7
 8// Bnf lexer.
 9var Bnf = internal.Register(MustNewLexer(
10	&Config{
11		Name:      "BNF",
12		Aliases:   []string{"bnf"},
13		Filenames: []string{"*.bnf"},
14		MimeTypes: []string{"text/x-bnf"},
15	},
16	Rules{
17		"root": {
18			{`(<)([ -;=?-~]+)(>)`, ByGroups(Punctuation, NameClass, Punctuation), nil},
19			{`::=`, Operator, nil},
20			{`[^<>:]+`, Text, nil},
21			{`.`, Text, nil},
22		},
23	},
24))