Sha256: c7d2fde513dcfb4e426bac79b2103592f3483cbd3565ac9719b61a63c23e9608

Contents?: true

Size: 1.54 KB

Versions: 19

Compression:

Stored size: 1.54 KB

Contents

# -*- coding: utf-8 -*- #

module Rouge
  module Lexers
    class MXML < RegexLexer
      title "MXML"
      desc "MXML"
      tag 'mxml'
      filenames '*.mxml'
      mimetypes 'application/xv+xml'

      state :root do
        rule /[^<&]+/, Text
        rule /&\S*?;/, Name::Entity

        rule /<!\[CDATA\[/m do
          token Comment::Preproc
          push :actionscript_content
        end

        rule /<!--/, Comment, :comment
        rule /<\?.*?\?>/, Comment::Preproc
        rule /<![^>]*>/, Comment::Preproc

        rule %r(<\s*[\w:.-]+)m, Name::Tag, :tag # opening tags
        rule %r(<\s*/\s*[\w:.-]+\s*>)m, Name::Tag # closing tags
      end

      state :comment do
        rule /[^-]+/m, Comment
        rule /-->/, Comment, :pop!
        rule /-/, Comment
      end

      state :tag do
        rule /\s+/m, Text
        rule /[\w.:-]+\s*=/m, Name::Attribute, :attribute
        rule %r(/?\s*>), Name::Tag, :root
      end

      state :attribute do
        rule /\s+/m, Text
        rule /(")({|@{)/m do
          groups Str, Punctuation
          push :actionscript_attribute
        end
        rule /".*?"|'.*?'|[^\s>]+/, Str, :tag
      end

      state :actionscript_content do
        rule /\]\]\>/m, Comment::Preproc, :pop!
        rule /.*?(?=\]\]\>)/m do
          delegate Actionscript
        end
      end

      state :actionscript_attribute do
        rule /(})(")/m do
          groups Punctuation, Str
          push :tag
        end
        rule /.*?(?=}")/m do
          delegate Actionscript
        end
      end
    end
  end
end

Version data entries

19 entries across 17 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/mxml.rb
rouge-3.2.1 lib/rouge/lexers/mxml.rb
rouge-3.2.0 lib/rouge/lexers/mxml.rb
rouge_ecl-1.0.0 lib/rouge/lexers/mxml.rb
rouge_ecl-0.0.1 lib/rouge/lexers/mxml.rb
rouge-3.1.1 lib/rouge/lexers/mxml.rb
rouge-3.1.0 lib/rouge/lexers/mxml.rb
rouge-3.0.0 lib/rouge/lexers/mxml.rb
rouge-2.2.1 lib/rouge/lexers/mxml.rb
rouge-2.2.0 lib/rouge/lexers/mxml.rb
rougegal-2.1.2 lib/rouge/lexers/mxml.rb
tdiary-5.0.5 vendor/bundle/gems/rouge-2.0.7/lib/rouge/lexers/mxml.rb
tdiary-5.0.5 vendor/bundle/gems/rouge-2.1.1/lib/rouge/lexers/mxml.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/rouge-2.0.7/lib/rouge/lexers/mxml.rb
rouge-2.1.1 lib/rouge/lexers/mxml.rb
rouge-2.1.0 lib/rouge/lexers/mxml.rb
tdiary-5.0.4 vendor/bundle/gems/rouge-2.0.7/lib/rouge/lexers/mxml.rb
rouge-2.0.7 lib/rouge/lexers/mxml.rb
rouge-2.0.6 lib/rouge/lexers/mxml.rb