X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=mad%2FNomad.pm;h=eaac474b783f37f8b39f7dadc1a09ac3cb0fd701;hb=35fe4187b13e55333f87abc0091ce2732e9382fb;hp=49659a8f0428698583fd16b95668233b1e3d35d2;hpb=e9cc17ba00cc39cdcabc27d876cb322b6bbd3a59;p=p5sagit%2Fp5-mst-13.2.git diff --git a/mad/Nomad.pm b/mad/Nomad.pm old mode 100755 new mode 100644 index 49659a8..eaac474 --- a/mad/Nomad.pm +++ b/mad/Nomad.pm @@ -440,6 +440,7 @@ sub newtype { sub madness { my $self = shift; my @keys = split(' ', shift); + @keys = map { $_ eq 'd' ? ('k', 'd') : $_ } @keys; my @vals = (); for my $key (@keys) { my $madprop = $self->{mp}{$key}; @@ -519,13 +520,8 @@ sub hash { for my $kid (@{$$self{Kids}}) { my ($k,$v) = $kid->pair($self, @_); $firstthing ||= $k; - if ($k =~ /^[_#]$/) { # rekey whitespace according to preceding entry - $k .= $lastthing; # (which is actually the token the whitespace is before) - } - else { - $k .= 'x' while exists $hash{$k}; - $lastthing = $k; - } + $k .= 'x' while exists $hash{$k}; + $lastthing = $k; $hash{$k} = $v; } $hash{FIRST} = $firstthing; @@ -678,7 +674,7 @@ sub ast { return P5AST::listop->new(Kids => [@before,@retval]); } - push @retval, $self->madness('o ( [ {'); + push @retval, $self->madness('o d ( [ {'); my @newkids; for my $kid (@{$$self{Kids}}) { @@ -1687,7 +1683,10 @@ sub ast { if ($rfirst[-1]->uni ne $llast[-1]->uni) { push @newkids, @rfirst; } - + # remove the fake '\n' if /e and '#' in replacement. + if (@mods and $mods[0] =~ m/e/ and ($self->madness('R'))[0]->uni =~ m/#/) { + unshift @rlast, bless {}, 'chomp'; # hack to remove '\n' + } push @newkids, $bits->{repl}, @rlast, @mods; my $retval = $self->newtype->new(Kids => [@newkids]); @@ -2839,6 +2838,7 @@ package PLXML::op_enterwrite; package PLXML::op_leavewrite; package PLXML::op_prtf; package PLXML::op_print; +package PLXML::op_say; package PLXML::op_sysopen; package PLXML::op_sysseek; package PLXML::op_sysread;