lib/rouge/lexers/haskell.rb in rouge_ecl-0.0.1 vs lib/rouge/lexers/haskell.rb in rouge_ecl-1.0.0

- old
+ new

@@ -9,12 +9,12 @@ tag 'haskell' aliases 'hs' filenames '*.hs' mimetypes 'text/x-haskell' - def self.detect?(text) - return true if text.shebang?('runhaskell') + def self.analyze_text(text) + return 1 if text.shebang?('runhaskell') end reserved = %w( _ case class data default deriving do else if in infix[lr]? instance let newtype of then type where @@ -53,10 +53,11 @@ state :root do mixin :basic rule /\bimport\b/, Keyword::Reserved, :import rule /\bmodule\b/, Keyword::Reserved, :module + rule /\berror\b/, Name::Exception rule /\b(?:#{reserved.join('|')})\b/, Keyword::Reserved # not sure why, but ^ doesn't work here # rule /^[_a-z][\w']*/, Name::Function rule /[_a-z][\w']*/, Name rule /[A-Z][\w']*/, Keyword::Type @@ -145,11 +146,11 @@ end state :character do rule /\\/ do token Str::Escape - goto :character_end + push :character_end push :escape end rule /./ do token Str::Char @@ -171,10 +172,10 @@ state :escape do rule /[abfnrtv"'&\\]/, Str::Escape, :pop! rule /\^[\]\[A-Z@\^_]/, Str::Escape, :pop! rule /#{ascii.join('|')}/, Str::Escape, :pop! rule /o[0-7]+/i, Str::Escape, :pop! - rule /x[\da-f]+/i, Str::Escape, :pop! + rule /x[\da-f]/i, Str::Escape, :pop! rule /\d+/, Str::Escape, :pop! rule /\s+\\/, Str::Escape, :pop! end end end