Commits

camlspotter  committed c944b04

working

  • Participants
  • Parent commits e63bee3
  • Branches dev

Comments (0)

Files changed (2)

+open Spotlib.Spot
+
 module Position = struct
   open Sexplib.Conv
 
     pos_cnum : int;
   } with sexp
 
-  let to_string t = 
+  let show t = 
     Printf.sprintf "%s%d:%d" 
       (if t.pos_fname = "" then "" else t.pos_fname ^ ":")
       t.pos_lnum 
       (t.pos_cnum - t.pos_bol)
 
+  let format ppf t = Format.fprintf ppf "%s" & show t
+
+  let top fname = { pos_fname = fname;
+                    pos_lnum = 1;
+                    pos_bol = 0;
+                    pos_cnum = 0 }
+
+  let none = Lexing.dummy_pos
+
+(*
   let zero = { pos_fname = "";
                pos_lnum = 1;
                pos_bol = 0;
                pos_lnum = 0;
                pos_bol = 0;
                pos_cnum = 0 }
+*)
 
   let columns p = p.pos_cnum - p.pos_bol
 
   type t = Position.t * Position.t with sexp
   let lnum (p,_) = p.pos_lnum
   let columns (p,_) = columns p
-  let zero = (Position.zero, Position.zero)
+(*  let zero = (Position.zero, Position.zero) *) (* CR jfuruse: to be removed *)
+  let none = (Position.none, Position.none)
   let move_chars diff (p,p') = 
     { p  with pos_cnum = p .pos_cnum + diff },
     { p' with pos_cnum = p'.pos_cnum + diff } 
   }
 end
 
-type t = (token, attr) zlist * in_channel
+type t = (Elem.t, Attr.t) zlist * in_channel
 
 let stream = fst
 let close (_, ic) = close_in ic
     in
     let space_between_region = (snd last_region, fst region) in
 
-    let attr = { region; substr; space = space_between_region, space_between } in
+    let attr = { Attr.region; substr; space = space_between_region, space_between } in
     match token with
     | EOF -> null_desc attr
     | _ -> cons_desc token attr (lazy (loop region))