Commit c88ed006 authored by POTTIER Francois's avatar POTTIER Francois

The previous commit would still print one trailing space

when the known stack suffix was empty. Fix that.
parent c0ee27ec
......@@ -269,7 +269,7 @@ let print_messages_auto (nt, sentence, otarget) : unit =
;
Printf.printf
"## The known suffix of the stack is as follows:\n\
## %s\n\
##%s\n\
##\n"
(Invariant.print (Invariant.stack s'))
;
......
......@@ -475,9 +475,8 @@ let fold_top f accu w =
let print (w : word) =
let b = Buffer.create 64 in
let separator = Misc.once "" " " in
fold (fun () _represented symbol _states ->
Buffer.add_string b (separator());
Buffer.add_char b ' ';
Buffer.add_string b (Symbol.print symbol)
) () w;
Buffer.contents b
......
......@@ -50,8 +50,8 @@ 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. *)
(* [print w] produces a string representation of the word [w]. Only the
symbols are shown. One space is printed in front of each symbol. *)
val print: word -> string
......
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