...

Source file src/github.com/alecthomas/chroma/lexers/t/termcap.go

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

     1  package t
     2  
     3  import (
     4  	. "github.com/alecthomas/chroma" // nolint
     5  	"github.com/alecthomas/chroma/lexers/internal"
     6  )
     7  
     8  // Termcap lexer.
     9  var Termcap = internal.Register(MustNewLazyLexer(
    10  	&Config{
    11  		Name:      "Termcap",
    12  		Aliases:   []string{"termcap"},
    13  		Filenames: []string{"termcap", "termcap.src"},
    14  		MimeTypes: []string{},
    15  	},
    16  	termcapRules,
    17  ))
    18  
    19  func termcapRules() Rules {
    20  	return Rules{
    21  		"root": {
    22  			{`^#.*$`, Comment, nil},
    23  			{`^[^\s#:|]+`, NameTag, Push("names")},
    24  		},
    25  		"names": {
    26  			{`\n`, Text, Pop(1)},
    27  			{`:`, Punctuation, Push("defs")},
    28  			{`\|`, Punctuation, nil},
    29  			{`[^:|]+`, NameAttribute, nil},
    30  		},
    31  		"defs": {
    32  			{`\\\n[ \t]*`, Text, nil},
    33  			{`\n[ \t]*`, Text, Pop(2)},
    34  			{`(#)([0-9]+)`, ByGroups(Operator, LiteralNumber), nil},
    35  			{`=`, Operator, Push("data")},
    36  			{`:`, Punctuation, nil},
    37  			{`[^\s:=#]+`, NameClass, nil},
    38  		},
    39  		"data": {
    40  			{`\\072`, Literal, nil},
    41  			{`:`, Punctuation, Pop(1)},
    42  			{`[^:\\]+`, Literal, nil},
    43  			{`.`, Literal, nil},
    44  		},
    45  	}
    46  }
    47  

View as plain text