@@ -966,6 +966,21 @@ sub new {
966966 bless { type => $type , %$fields }, $class ;
967967}
968968
969+ sub stringifyHash {
970+ my ($self , $hash ) = @_ ;
971+ return '{ ' . join(
972+ ', ',
973+ map {
974+ "$_ => "
975+ . (
976+ ref ($hash ->{$_ }) eq 'HASH'
977+ ? $self ->stringifyHash($hash ->{$_ })
978+ : ("'" . $self->quote($hash->{$_}) . "'"))
979+ } PGML::Sort(keys %$hash)
980+ ) . ' }';
981+
982+ }
983+
969984sub show {
970985 my $self = shift ;
971986 my $indent = shift || "" ;
@@ -974,7 +989,9 @@ sub show {
974989 next if $id eq "stack" ;
975990 if (ref($self ->{$id }) eq 'ARRAY' ) {
976991 push(@strings ,
977- $indent . $id . ": [" . join(',', map { "'" . $self->quote($_) . "'" } @{ $self->{$id} }) . "]");
992+ $indent . $id . ": [" . join(', ', map { "'" . $self->quote($_) . "'" } @{ $self->{$id} }) . "]");
993+ } elsif (ref($self->{$id}) eq 'HASH') {
994+ push (@strings , $indent . $id . ": " . $self->stringifyHash($self->{$id}));
978995 } else {
979996 push (@strings , $indent . $id . ": '" . $self->quote($self->{$id}) . "'");
980997 }
@@ -1227,7 +1244,7 @@ sub show {
12271244 my $self = shift ;
12281245 my $indent = shift ;
12291246 my @strings = ($self ->SUPER ::show($indent ));
1230- push(@strings , $indent . "stack: ['" . join("','", map { $self->quote($_) } @{ $self->{stack} }) . "']");
1247+ push(@strings , $indent . "stack: ['" . join("', '", map { $self->quote($_) } @{ $self->{stack} }) . "']");
12311248 return join("\n" , @strings );
12321249}
12331250
0 commit comments