Sha256: 05a6293ddb474eae33b331819d1e00f11bd5b0b13b2359d9afd0e95c5384f88e

Contents?: true

Size: 1023 Bytes

Versions: 44

Compression:

Stored size: 1023 Bytes

Contents

# frozen_string_literal: true

module Rouge
  module Lexers
    load_lexer 'xml.rb'

    class BIML < XML
      title "BIML"
      desc "BIML, Business Intelligence Markup Language"
      tag 'biml'
      filenames '*.biml'

      def self.detect?(text)
        return true if text =~ /<\s*Biml\b/
      end

      prepend :root do
        rule %r(<#\@\s*)m, Name::Tag, :directive_tag

        rule %r(<#[=]?\s*)m, Name::Tag, :directive_as_csharp
      end

      prepend :attr do
        #TODO: how to deal with embedded <# tags inside a attribute string
        #rule %r("<#[=]?\s*)m, Name::Tag, :directive_as_csharp
      end

      state :directive_as_csharp do
        rule %r/\s*#>\s*/m, Name::Tag, :pop!
        rule %r(.*?(?=\s*#>\s*))m do
          delegate CSharp
        end
      end

      state :directive_tag do
        rule %r/\s+/m, Text
        rule %r/[\w.:-]+\s*=/m, Name::Attribute, :attr
        rule %r/\w+\s*/m, Name::Attribute
        rule %r(/?\s*#>), Name::Tag, :pop!
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
rouge-4.5.1 lib/rouge/lexers/biml.rb
rouge-4.5.0 lib/rouge/lexers/biml.rb
rouge-4.4.0 lib/rouge/lexers/biml.rb
rouge-4.3.0 lib/rouge/lexers/biml.rb
rouge-4.2.1 lib/rouge/lexers/biml.rb
rouge-4.2.0 lib/rouge/lexers/biml.rb
rouge-4.1.3 lib/rouge/lexers/biml.rb
rouge-4.1.2 lib/rouge/lexers/biml.rb
rouge-4.1.1 lib/rouge/lexers/biml.rb
mumukit-content-type-1.12.1 vendor/bundle/ruby/2.7.0/gems/rouge-3.30.0/lib/rouge/lexers/biml.rb
mumukit-content-type-1.12.0 vendor/bundle/ruby/2.7.0/gems/rouge-3.30.0/lib/rouge/lexers/biml.rb
rouge-4.1.0 lib/rouge/lexers/biml.rb
rouge-4.0.1 lib/rouge/lexers/biml.rb
rouge-4.0.0 lib/rouge/lexers/biml.rb
rouge-3.30.0 lib/rouge/lexers/biml.rb
rouge-3.29.0 lib/rouge/lexers/biml.rb
rouge-3.28.0 lib/rouge/lexers/biml.rb
rouge-3.27.0 lib/rouge/lexers/biml.rb
rouge-3.26.1 lib/rouge/lexers/biml.rb
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/rouge-3.26.0/lib/rouge/lexers/biml.rb