...

Source file src/github.com/alecthomas/chroma/lexers/a/apache.go

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

     1  package a
     2  
     3  import (
     4  	. "github.com/alecthomas/chroma" // nolint
     5  	"github.com/alecthomas/chroma/lexers/internal"
     6  )
     7  
     8  // Apacheconf lexer.
     9  var Apacheconf = internal.Register(MustNewLazyLexer(
    10  	&Config{
    11  		Name:            "ApacheConf",
    12  		Aliases:         []string{"apacheconf", "aconf", "apache"},
    13  		Filenames:       []string{".htaccess", "apache.conf", "apache2.conf"},
    14  		MimeTypes:       []string{"text/x-apacheconf"},
    15  		CaseInsensitive: true,
    16  	},
    17  	apacheconfRules,
    18  ))
    19  
    20  func apacheconfRules() Rules {
    21  	return Rules{
    22  		"root": {
    23  			{`\s+`, Text, nil},
    24  			{`(#.*?)$`, Comment, nil},
    25  			{`(<[^\s>]+)(?:(\s+)(.*?))?(>)`, ByGroups(NameTag, Text, LiteralString, NameTag), nil},
    26  			{`([a-z]\w*)(\s+)`, ByGroups(NameBuiltin, Text), Push("value")},
    27  			{`\.+`, Text, nil},
    28  		},
    29  		"value": {
    30  			{`\\\n`, Text, nil},
    31  			{`$`, Text, Pop(1)},
    32  			{`\\`, Text, nil},
    33  			{`[^\S\n]+`, Text, nil},
    34  			{`\d+\.\d+\.\d+\.\d+(?:/\d+)?`, LiteralNumber, nil},
    35  			{`\d+`, LiteralNumber, nil},
    36  			{`/([a-z0-9][\w./-]+)`, LiteralStringOther, nil},
    37  			{`(on|off|none|any|all|double|email|dns|min|minimal|os|productonly|full|emerg|alert|crit|error|warn|notice|info|debug|registry|script|inetd|standalone|user|group)\b`, Keyword, nil},
    38  			{`"([^"\\]*(?:\\.[^"\\]*)*)"`, LiteralStringDouble, nil},
    39  			{`[^\s"\\]+`, Text, nil},
    40  		},
    41  	}
    42  }
    43  

View as plain text