From 1982cc34b6948a6f112609dc573aac5e653e81f7 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 16 Mar 2008 10:48:59 +0100 Subject: [PATCH] support Literate Haskell --- ext/ohcount_native/generator.rb | 10 ++++++++++ lib/ohcount/detector.rb | 1 + lib/ohcount/sloc_info.rb | 1 + 3 files changed, 12 insertions(+) diff --git a/ext/ohcount_native/generator.rb b/ext/ohcount_native/generator.rb index 99c2ee2..fa73c7d 100644 --- a/ext/ohcount_native/generator.rb +++ b/ext/ohcount_native/generator.rb @@ -54,6 +54,15 @@ module Ohcount fortranfixed = CMonoglot.new("fortranfixed", '^[^ \n]', nil, true, true, {:no_escape_dquote => true, :no_escape_squote => true}) fortranfree = CMonoglot.new("fortranfree", '!', nil, true, true, {:no_escape_dquote => true, :no_escape_squote => true}) haskell = CMonoglot.new("haskell", '--', [e('{-'), e('-}')], true, false) + lit_haskell = Biglot.new("lit_haskell", documentation, haskell, [ + ["haskell", :oneliner, :code], + ], [ + # techinically, the next one should only work when following a blank ... how to enforce it? + ['^>', :documentation_text, :haskell_oneliner, :to, false, 'chicken'], + ['\n', :haskell_oneliner, :return, :from, false, 'chicken'], + ['^'+e('\begin{code}'), :documentation_text, :haskell_code, :from, false, 'code_block'], + ['^'+e('\end{code}'), :haskell_code, :return, :to, false, 'code_block'] + ]); lisp = LineCommentMonoglot.new("lisp", ";") lua = CMonoglot.new("lua", '--', nil, true, true) matlab = CMonoglot.new("matlab", '#|%', ['{%', '%}'], false,true) @@ -164,6 +173,7 @@ module Ohcount jsp, c_web, knuth_web, + lit_haskell, clearsilver_template, tex, metapost_with_tex diff --git a/lib/ohcount/detector.rb b/lib/ohcount/detector.rb index afe0968..60aad82 100644 --- a/lib/ohcount/detector.rb +++ b/lib/ohcount/detector.rb @@ -149,6 +149,7 @@ class Ohcount::Detector '.java' => "java", '.js' => "javascript", '.jsp' => "jsp", + '.lhs' => "lit_haskell", '.lua' => "lua", '.lsp' => "lisp", '.lisp' => "lisp", diff --git a/lib/ohcount/sloc_info.rb b/lib/ohcount/sloc_info.rb index f77fe81..2b1bc8f 100644 --- a/lib/ohcount/sloc_info.rb +++ b/lib/ohcount/sloc_info.rb @@ -87,6 +87,7 @@ class Ohcount::SlocInfo 'xslt' => {:nice_name => 'XSL Transformation',:category => 0}, 'dmd' => {:nice_name => 'D' , :category => 0}, 'tex' => {:nice_name => 'TeX/LaTeX' , :category => 1}, + 'lit_haskell' => {:nice_name => 'Literate Haskell' , :category => 0}, 'haskell' => {:nice_name => 'Haskell' , :category => 0} } -- 2.32.0.93.g670b81a890