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