Sha256: 4131f436da07c7f4d16bdd6adc3965897b5739747e31710a68fdcedf6d29f5e6

Contents?: true

Size: 823 Bytes

Versions: 44

Compression:

Stored size: 823 Bytes

Contents

# -*- coding: utf-8 -*- #
# frozen_string_literal: true

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 %r/\s*?\n(?=>)/, Text, :code
        rule %r/.*?\n/, Text
        rule %r/.+\z/, Text
      end

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

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

Version data entries

44 entries across 44 versions & 2 rubygems

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