Skip to content

Commit

Permalink
don't skip to end of pstr in CommaSeparatedCharList token variant (#2356
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mthom committed Mar 13, 2024
1 parent ca8e280 commit 6f7f979
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/heap_print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,12 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
let focus = self.iter.focus();
let mut heap_pstr_iter = HeapPStrIter::new(self.iter.heap, focus.value() as usize);

let next_h;
let next_hare;

if heap_pstr_iter.next().is_some() {
next_h = heap_pstr_iter.focus;
next_hare = heap_pstr_iter.focus();
for _ in heap_pstr_iter.by_ref() {}
} else {
return self.push_list(max_depth);
Expand Down Expand Up @@ -1283,15 +1288,16 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
// print an extraneous number. pstr offset value cells are never
// used by the iterator to mark cyclic terms so the removal is safe.
self.iter.pop_stack();
Some(end_h)
Some(next_hare)
// Some(end_h)
} else {
None
};

if !self.max_depth_exhausted(max_depth) {
let pstr = cell_as_string!(self.iter.heap[h]);
self.state_stack.push(TokenOrRedirect::CommaSeparatedCharList(CommaSeparatedCharList {
pstr, offset, max_depth, end_cell, end_h,
pstr, offset, max_depth, end_cell: next_h, end_h,
}));
} else {
self.state_stack.push(TokenOrRedirect::Atom(atom!("...")));
Expand Down

0 comments on commit 6f7f979

Please sign in to comment.