Sha256: c9cc77a3f947d7a9e2bf861a9c31b7c6a081a53def8dec297fe7fc3075f7d66b
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
module Rouge module Lexers class Nginx < RegexLexer tag 'nginx' mimetypes 'text/x-nginx-conf' id = /[^\s$;{}()#]+/ state :root do rule /(include)(\s+)([^\s;]+)/ do group 'Keyword'; group 'Text'; group 'Name' end rule id, 'Keyword', :statement mixin :base end state :block do rule /}/, 'Punctuation', :pop! rule id, 'Keyword.Namespace', :statement mixin :base end state :statement do rule /{/ do token 'Punctuation'; pop!; push :block end rule /;/, 'Punctuation', :pop! mixin :base end state :base do rule /\s+/, 'Text' rule /#.*?\n/, 'Comment.Single' rule /(?:on|off)\b/, 'Name.Constant' rule /[$][\w-]+/, 'Name.Variable' # host/port rule /([a-z0-9.-]+)(:)([0-9]+)/i do group 'Name.Function'; group 'Punctuation' group 'Literal.Number.Integer' end # mimetype rule %r([a-z-]+/[a-z-]+)i, 'Name.Class' rule /[0-9]+[kmg]?\b/i, 'Literal.Number.Integer' rule /(~)(\s*)([^\s{]+)/ do group 'Punctuation'; group 'Text'; group 'Literal.String.Regex' end rule /[:=~]/, 'Punctuation' # pathname rule %r(/#{id}?), 'Name' rule /[^#\s;{}$\\]+/, 'Literal.String' # catchall rule /[$;]/, 'Text' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rouge-0.2.8 | lib/rouge/lexers/nginx.rb |