Skip Menu |

This queue is for tickets about the Tree-Parser CPAN distribution.

Report information
The Basics
Id: 12244
Status: resolved
Priority: 0/
Queue: Tree-Parser

People
Owner: Nobody in particular
Requestors: cullman [...] delta.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.09
Fixed in: (no value)



Subject: De-parsing issue with the nested parens parser
Hi I'm using the excellent Tree::Parser 0.09 which I got as a PPM package from the ActiveState PPM2 repository. If you generate a tree that looks like this: 1 2 3 4 The function will deparse this tree as: (1 (2 (3) 4) Instead of: (1 (2 (3)) 4) There is a problem in the $NESTED_PARENS_DEPARSE function on lines 271 - 273. elsif ($prev_depth > $current_depth) { $output .= ") "; } This should read something like elsif ($prev_depth > $current_depth) { my $delta = $prev_depth - $current_depth; $output .= ")" x $delta . " "; } Thanks, Chad Ullman
Chad, Thanks very much for the bug report. I have applied your suggested code fix and written a test to confirm it works correctly. Tree::Parser 0.10 should arrive on CPAN in a few hours. Thanks again, Stevan [guest - Mon Apr 11 13:37:38 2005]: Show quoted text
> Hi > > I'm using the excellent Tree::Parser 0.09 which I got as a PPM package > from the ActiveState PPM2 repository. > > If you generate a tree that looks like this: > 1 > 2 > 3 > 4 > > The function will deparse this tree as: > (1 (2 (3) 4) > Instead of: > (1 (2 (3)) 4) > > There is a problem in the $NESTED_PARENS_DEPARSE function on lines 271 > - 273. > > elsif ($prev_depth > $current_depth) { > $output .= ") "; > } > > This should read something like > elsif ($prev_depth > $current_depth) { > my $delta = $prev_depth - $current_depth; > $output .= ")" x $delta . " "; > } > > Thanks, > Chad Ullman