Sha256: b06aefe628fa82e464dce9165bb4718d0966b715ec60c87f65fce50092d62a28

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

module Rouge
  module Lexers
    class Plist < RegexLexer
      desc 'plist'
      tag 'plist'
      aliases 'plist'
      filenames *%w(*.plist *.pbxproj)

      mimetypes 'text/x-plist', 'application/x-plist'

      def self.analyze_text(text)
        return 0.6 if text.start_with?("// !$*UTF8*$!")
      end

      state :whitespace do
        rule /\s+/, Text::Whitespace
      end

      state :root do
        rule %r{//.*$}, Comment
        rule %r{/\*.+?\*/}m, Comment
        mixin :whitespace
        rule /{/, Punctuation, :dictionary
        rule /\(/, Punctuation, :array
        rule /"([^"\\]|\\.)*"/, Literal::String::Double
        rule /'([^'\\]|\\.)*'/, Literal::String::Single
        rule /</, Punctuation, :data
        rule %r{[\w_$/:.-]+}, Literal
      end

      state :dictionary do
        mixin :root
        rule /[=;]/, Punctuation
        rule /}/, Punctuation, :pop!
      end

      state :array do
        mixin :root
        rule /[,]/, Punctuation
        rule /\)/, Punctuation, :pop!
      end

      state :data do
        rule /[\h\s]+/, Literal::Number::Hex
        rule />/, Punctuation, :pop!
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 5 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/rouge-2.2.1/lib/rouge/lexers/plist.rb
rouge_ecl-1.0.0 lib/rouge/lexers/plist.rb
rouge-2.2.1 lib/rouge/lexers/plist.rb
rouge-2.2.0 lib/rouge/lexers/plist.rb
rougegal-2.1.2 lib/rouge/lexers/plist.rb
tdiary-5.0.5 vendor/bundle/gems/rouge-2.1.1/lib/rouge/lexers/plist.rb
rouge-2.1.1 lib/rouge/lexers/plist.rb
rouge-2.1.0 lib/rouge/lexers/plist.rb