24 lines
438 B
Go
24 lines
438 B
Go
package lexers
|
|
|
|
import (
|
|
. "github.com/alecthomas/chroma" // nolint
|
|
)
|
|
|
|
// Bnf lexer.
|
|
var Bnf = Register(MustNewLexer(
|
|
&Config{
|
|
Name: "BNF",
|
|
Aliases: []string{"bnf"},
|
|
Filenames: []string{"*.bnf"},
|
|
MimeTypes: []string{"text/x-bnf"},
|
|
},
|
|
Rules{
|
|
"root": {
|
|
{`(<)([ -;=?-~]+)(>)`, ByGroups(Punctuation, NameClass, Punctuation), nil},
|
|
{`::=`, Operator, nil},
|
|
{`[^<>:]+`, Text, nil},
|
|
{`.`, Text, nil},
|
|
},
|
|
},
|
|
))
|