...

Source file src/github.com/alecthomas/chroma/lexers/b/bnf.go

Documentation: github.com/alecthomas/chroma/lexers/b

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

View as plain text