camlspotter avatar camlspotter committed 151412f

update

Comments (0)

Files changed (4)

 CVS/.*
 gen_phantom$
 phantom\.ml.*
+date_lexer\.ml$
 OMakeroot
 setup.data
 setup.log
 OCAML_BYTE_LINK_FLAGS +=
 OCAML_NATIVE_LINK_FLAGS +=
 
-OCAMLPACKS[]= unix str
+OCAMLPACKS[]= unix str oUnit
 
-# OCAMLDEPFLAGS= -syntax camlp4o -package sexplib.syntax
-# OCAMLPPFLAGS= -syntax camlp4o -package sexplib.syntax
+OCAMLDEPFLAGS= -syntax camlp4o -package pa_ounit
+OCAMLPPFLAGS= -syntax camlp4o -package pa_ounit
 
 # OCamlGeneratedFiles(parser.ml lexer.ml)
 OCamlGeneratedFiles(phantomy.ml phantomy.mli)
    mtypes
    option
    result
-   stream
+   spotStream
    exn
+   date_lexer
    date
    xlist
    xhashtbl
 
 MyOCamlPackage($(LIB), $(LIBFILES), $(EMPTY), $(EMPTY))
 
+date_lexer.ml: date_lexer.mll
+    ocamllex $<
+
 PHANTOM_GEN[] =
    monad_intf
    monad
 phantom.mli: phantom_head.mli gen_phantom.run
 	./gen_phantom.run mli > $@
 
-date.ml: date.mll
-    ocamllex date.mll
+section:
+  OCAML_LIBS=spotlib
+  MyOCamlTestProgram($(LIB)_test, $(LIB)_test)

lib/date.mll

-{
-  (** Date *)
-  
-  type t = {
-    year : int;  (* 1998 *)
-    month : int; (* 1-12 *)
-    day : int
-  }
-
-}
-
-let digit = ['0'-'9']
-
-rule parse_date = parse
-  | (digit digit digit digit as year)
-    '-'
-    (digit digit as month)
-    '-'
-    (digit digit as day)
-    {
-      { year  = int_of_string year;
-        month = int_of_string month;
-        day   = int_of_string day 
-      }
-    }
-
-{
-  open Base
-
-  let to_string t = Printf.sprintf "%04d-%02d-%02d" t.year t.month t.day
-  
-(*
-  let int_of_string_in_digit s =
-    let sum = ref 0 in
-    for i = 0 to String.length s - 1 do
-      match String.unsafe_get s i with
-      | ('0'..'9' as c) ->
-          sum := !sum * 10 + Char.code c - Char.code '0'
-      | _ -> invalid_arg "Date.int_of_string_in_digit" 
-    done;
-    !sum
-*)
-  
-  exception Parse_error
-
-  let of_string_exn s = 
-    try parse_date & Lexing.from_string s with _ -> raise Parse_error
-
-  let of_string s = 
-    Result.catch_exn & fun () -> parse_date & Lexing.from_string s
-  
-  let test () =
-    assert (to_string { year = 2000; month = 4; day = 1 } 
-            = "2000-04-01");
-    assert (of_string "2000-04-01" = `Ok { year = 2000; month = 4; day = 1 });
-  
-  (*
-  let _ = test ()
-  *)
-
-}
 module Comopt     = Comopt
 module Overload   = Overload
 module Mtypes     = Mtypes
-module Stream     = Stream
+module Stream     = SpotStream
 module Result     = Result
 include Result.Pervasives
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.