Commit 649a9346 authored by POTTIER Francois's avatar POTTIER Francois

Added [Invariant.print].

parent 6bcdda05
......@@ -517,6 +517,14 @@ let fold_top f accu w =
| (symbol, states) :: _ ->
f (representeds states) symbol
let print (w : word) =
let b = Buffer.create 64 in
fold (fun () _represented symbol _states ->
Buffer.add_string b (Symbol.print symbol);
Buffer.add_char b ' '
) () w;
Buffer.contents b
(* ------------------------------------------------------------------------ *)
(* Explain how the stack should be deconstructed when an error is
found.
......
......@@ -34,6 +34,11 @@ val fold: ('a -> bool -> Symbol.t -> Lr1.NodeSet.t -> 'a) -> 'a -> word -> 'a
val fold_top: (bool -> Symbol.t -> 'a) -> 'a -> word -> 'a
(* [print w] produces a string representation of the word [w]. Only
the symbols are shown. *)
val print: word -> string
(* ------------------------------------------------------------------------- *)
(* Information about the stack. *)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment