Sha256: fa669773b5e9a7db64586a7e387627ec50a5785ad78891c54c6237b5cddbea91
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
module Rouge module Lexers class Properties < RegexLexer desc '.properties config files for Java' tag 'properties' filenames '*.properties' mimetypes 'text/x-java-properties' def self.analyze_text(text) return 0.1 if text =~ /\A\[[\w.]+\]\s*\w+=\w+/ end identifier = /[\w.]+/ state :basic do rule /[!#].*?\n/, Comment rule /\s+/, Text rule /\\\n/, Str::Escape end state :root do mixin :basic rule /(#{identifier})(\s*)([=:])/ do groups Name::Property, Text, Punctuation push :value end end state :value do rule /\n/, Text, :pop! mixin :basic rule /"/, Str, :dq rule /'.*?'/, Str mixin :esc_str rule /[^\\\n]+/, Str end state :dq do rule /"/, Str, :pop! mixin :esc_str rule /[^\\"]+/m, Str end state :esc_str do rule /\\u[0-9]{4}/, Str::Escape rule /\\./m, Str::Escape end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rouge-1.5.0 | lib/rouge/lexers/properties.rb |
rouge-1.4.0 | lib/rouge/lexers/properties.rb |
rouge-1.3.4 | lib/rouge/lexers/properties.rb |