caml2html_test.mli

   1: type 'a weird = E10
   2: type t = [ `A | `C | `D | `E | `b of int ]
   3: module Zéro'04 :
   4:   sig val characters : char list val n : int val the_Truth : bool end
   5: val hel'Lo : string
   6: val ( |* ) : int -> int -> int
   7: val t : 'a -> 'a * 'a
   8: val a : 'a -> ('a * 'a) * ('a * 'a)
   9: val b :
  10:   'a ->
  11:   ((('a * 'a) * ('a * 'a)) * (('a * 'a) * ('a * 'a))) *
  12:   ((('a * 'a) * ('a * 'a)) * (('a * 'a) * ('a * 'a)))

caml2html_test.ml

   1: 
   2: (* Test file for <a href="http://martin.jambon.free.fr/caml2html.html">caml2html</a> (the first line is empty) *)
   3: 
   4: (* -hc option: <a href="#caml2html_test.mli">link to caml2html_test.mli</a> (same page, colorized)
   5:  *             <a href="caml2html_test.ml">link to caml2html_test.ml</a> (source) *)
   6: 
   7: (* This is a multi-line "*)"
   8:    comment *)
   9: 
  10: open Printf
  11: 
  12: type 'aa' weird = E10
  13: 
  14: type t = [ `A | `b of int | ` C | ` (* *) D | `
  15:             E ]
  16: 
  17: (* nested (* comments *) *)
  18: (* "multi-
  19:     line string in comment" *)
  20: 
  21: 

Hello

This is HTML!

  28: 
  29: 
Mon Aug 2 16:02:30 PDT 2010
  30: 
  31: 
Cnzy2ugzy ehyrf! "*)"
  32: 
  33: (*foo*)
  34: 
  35: module Zéro'04 = 
  36: struct
  37:   let characters = [ 'a'; '\000'; '\x12'; '
  38: '; '\t'; 'z' ]
  39:   let n = 0X12 + truncate 1.2E-1_2
  40:   let the_Truth =
  41:     let ignore4 a b c d = false in
  42:     not (ignore4 1._0_None 1.0E10E10)
  43: end
  44: 
  45: let hel'Lo = "\"Hello \
  46:                 World!\""
  47: 
  48: let ( |* ) a b =
  49:   match a, b with
  50:       1, 0 | 0, 1 -> 1+1
  51:     | _ -> 0
  52: 
  53: let _ =
  54:   assert true;
  55:   if 0 mod 1 < 1 && `Abc <> `def then
  56:     print_endline hel'Lo
  57: ;;
  58: 
  59: (* long types *)
  60: let t x = (x, x)
  61: let a x = t (t x)
  62: let b x = a (a x)
  63: let _ = fun x -> b (b x)
  64: ;;
  65: 
  66: # 123 (* line directives are not parsed, sorry... *)

caml2html_test2.ml

   1: let add_operator ~name ~level ~value =
   2:   EXTEND
   3:     Pcaml.expr: LEVEL $level$ [
   4:       [ x = SELF; $name$; y = SELF -> 
   5:           <:expr< $value$ $x$ $y$ >> ]
   6:     ];
   7:   END
   8: 
   9: EXTEND
  10:   Pcaml.str_item: [
  11:     [ "OPERATOR"; name = STRING; "LEVEL"; level = STRING; 
  12:       "VALUE"; value = Pcaml.expr; "END" ->
  13:         add_operator 
  14:           ~name:(Token.eval_string _loc name) 
  15:           ~level:(Token.eval_string _loc level) 
  16:           ~value;
  17:         <:str_item< declare end >> ]
  18:   ];
  19: END
  20: 
  21: 
  22: 
  23: let expand _loc e =
  24:   <:expr< 1 + 
  25:           $e$ >>

This document was generated using caml2html