Ticket #210: 0001-Add-minimal-OCaml-support.patch
| File 0001-Add-minimal-OCaml-support.patch, 5.2 kB (added by Samuel Bronson, 1 year ago) |
|---|
-
a/ext/ohcount_native/generator.rb
old new 51 51 metafont = LineCommentMonoglot.new("metafont", "%"); 52 52 metapost = LineCommentMonoglot.new("metapost", "%"); 53 53 objective_c = CMonoglot.new("objective_c", '//', [e('/*'), e('*/')], true, false) 54 ocaml = CMonoglot.new("ocaml", nil, [e('(*'), e('*)')], true, false) 54 55 pascal = CMonoglot.new("pascal", '//', ['{','}'], true, true, {:no_escape_dquote => true, :no_escape_squote => true}) 55 56 perl = CMonoglot.new("perl", '#', ['^=\\\\w+', '^=cut[ \t]*\\\\n'], true, true) 56 57 phplanguage = CMonoglot.new("php", ['//', '#'], [e('/*'), e('*/')], true, true, {:polyglot_name => 'phplanguage'}) … … 119 120 metafont, 120 121 metapost, 121 122 objective_c, 123 ocaml, 122 124 pascal , 123 125 perl , 124 126 pike , -
a/lib/ohcount/detector.rb
old new 164 164 '.lisp' => "lisp", 165 165 '.m' => :matlab_or_objective_c, 166 166 '.mf' => 'metafont', 167 '.ml' => 'ocaml', 168 '.ml4' => 'ocaml', 169 '.mli' => 'ocaml', 167 170 '.mk' => 'make', 168 171 '.mm' => "objective_c", 169 172 '.mp' => 'metapost_with_tex', -
a/lib/ohcount/sloc_info.rb
old new 72 72 'metapost' => {:nice_name => 'MetaPost' , :category => 1}, 73 73 'mxml' => {:nice_name => 'Flex' , :category => 1}, 74 74 'objective_c' => {:nice_name => 'Objective C' , :category => 0}, 75 'ocaml' => {:nice_name => 'Objective Caml' , :category => 0}, 75 76 'pascal' => {:nice_name => 'Pascal' , :category => 0}, 76 77 'perl' => {:nice_name => 'Perl' , :category => 0}, 77 78 'php' => {:nice_name => 'PHP' , :category => 0}, -
/dev/null
old new -
/dev/null
old new 1 let rec fib n = 2 match n with 3 | 0 -> 1 4 | 1 -> 1 5 | _ -> fib (n-2) + fib (n-1) 6 ;; -
/dev/null
old new -
/dev/null
old new 1 (* really stupid way to calculate a number in the fibonacci sequence *) 2 3 let rec fib n = 4 match n with 5 | 0 -> 1 6 | 1 -> 1 7 | _ -> fib (n-2) + fib (n-1) 8 ;; -
/dev/null
old new 1 # This has been shamelessly copied from java_test.rb because my Ruby is not so 2 # good and I don't really know what people expect from a Ohcount language test 3 # -- Reinier Lamers 2008-01-19 4 # Ditto from haskell_test.rb 5 # -- Samuel Bronson 2008-06-14 6 require File.dirname(__FILE__) + '/../test_helper' 7 8 class Ohcount::OcamlTest < Ohcount::Test 9 def test_comments 10 lb = [Ohcount::LanguageBreakdown.new("ocaml", "", "(* comment *)", 0)] 11 assert_equal lb, Ohcount::parse("(* comment *)", "ocaml") 12 end 13 14 def test_comprehensive 15 verify_parse("ocaml1.ml") 16 end 17 end