Sha256: 557529d2fe6a7860fa60c22d260fe6f3c7beaae1f14e04c93ff6407911ecd094

Contents?: true

Size: 783 Bytes

Versions: 32

Compression:

Stored size: 783 Bytes

Contents

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

module Rouge
  module Lexers
    class LiterateHaskell < RegexLexer
      title "Literate Haskell"
      desc 'Literate haskell'
      tag 'literate_haskell'
      aliases 'lithaskell', 'lhaskell', 'lhs'
      filenames '*.lhs'
      mimetypes 'text/x-literate-haskell'

      def haskell
        @haskell ||= Haskell.new(options)
      end

      start { haskell.reset! }

      # TODO: support TeX versions as well.
      state :root do
        rule /\s*?\n(?=>)/, Text, :code
        rule /.*?\n/, Text
        rule /.+\z/, Text
      end

      state :code do
        rule /(>)( .*?(\n|\z))/ do |m|
          token Name::Label, m[1]
          delegate haskell, m[2]
        end

        rule /\s*\n(?=\s*[^>])/, Text, :pop!
      end
    end
  end
end

Version data entries

32 entries across 30 versions & 6 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/rouge-2.2.1/lib/rouge/lexers/literate_haskell.rb
rouge-3.2.1 lib/rouge/lexers/literate_haskell.rb
rouge-3.2.0 lib/rouge/lexers/literate_haskell.rb
rouge_ecl-1.0.0 lib/rouge/lexers/literate_haskell.rb
rouge_ecl-0.0.1 lib/rouge/lexers/literate_haskell.rb
rouge-3.1.1 lib/rouge/lexers/literate_haskell.rb
rouge-3.1.0 lib/rouge/lexers/literate_haskell.rb
rouge-3.0.0 lib/rouge/lexers/literate_haskell.rb
rouge-2.2.1 lib/rouge/lexers/literate_haskell.rb
rouge-2.2.0 lib/rouge/lexers/literate_haskell.rb
rougegal-2.1.2 lib/rouge/lexers/literate_haskell.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/rouge-2.0.7/lib/rouge/lexers/literate_haskell.rb
tdiary-5.0.5 vendor/bundle/gems/rouge-2.0.7/lib/rouge/lexers/literate_haskell.rb
tdiary-5.0.5 vendor/bundle/gems/rouge-2.1.1/lib/rouge/lexers/literate_haskell.rb
rouge-2.1.1 lib/rouge/lexers/literate_haskell.rb
rouge-2.1.0 lib/rouge/lexers/literate_haskell.rb
tdiary-5.0.4 vendor/bundle/gems/rouge-2.0.7/lib/rouge/lexers/literate_haskell.rb
rouge-2.0.7 lib/rouge/lexers/literate_haskell.rb
rouge-2.0.6 lib/rouge/lexers/literate_haskell.rb
rouge-2.0.5 lib/rouge/lexers/literate_haskell.rb