/usr/lib/ruby/vendor_ruby/rugments/lexers/literate_haskell.rb is in ruby-rugments 1.0.0~beta8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | module Rugments
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
|