Source

ocaml-indent / machine.ml

Diff from to

machine.ml

   | _ :: bs -> unwind_top bs
   | [] -> []
 
+open Planck.Lazylist (* for Cons and Null *)
+
 (* true means I found something to make the token a block *)
-let rec lparen_read_ahead lnum str =
-  match Tokenstr.destr str with
-  | None -> false
-  | Some (i, _) when Region.lnum i.Tokenstr.region <> lnum -> false
-  | Some (i, str) ->
+let rec lparen_read_ahead lnum = function
+  | lazy Null _ -> false
+  | lazy Cons (i, _, _) when Region.lnum i.Tokenstr.region <> lnum -> false
+  | lazy Cons (i, _, str) ->
       match i.Tokenstr.token with
       | COMMENT _ -> lparen_read_ahead lnum str
       | FUN -> false
       | FUNCTION -> false
       | _ -> true
 
-let lbrace_read_ahead lnum str =
-  match Tokenstr.destr str with
-  | None -> false
-  | Some (i, _) when Region.lnum i.Tokenstr.region <> lnum -> false
-  | Some (i, str) ->
+let lbrace_read_ahead lnum = function
+  | lazy Null _ -> false
+  | lazy Cons (i, _, _) when Region.lnum i.Tokenstr.region <> lnum -> false
+  | lazy Cons (i, _,str) ->
       match i.Tokenstr.token with
       | COMMENT _ -> lparen_read_ahead lnum str
       | _ -> true