from Nomad.pm to dump.c. So they are already combined in the XML
dump.
Subject: [PATCH] mad: combine whitespace keys '_' '#' in dump.c instead of Nomad.pm
Message-Id: <
20070508170341.GH17043@ostwald>
p4raw-id: //depot/perl@31207
}
if (PL_madskills && o->op_madprop) {
+ char prevkey = '\0';
SV *tmpsv = newSVpvn("", 0);
MADPROP* mp = o->op_madprop;
sv_utf8_upgrade(tmpsv);
sv_setpvn(tmpsv,"\"",1);
if (tmp)
sv_catxmlpvn(tmpsv, &tmp, 1, 0);
+ if ((tmp == '_') || (tmp == '#')) /* '_' '#' whitespace belong to the previous token. */
+ sv_catxmlpvn(tmpsv, &prevkey, 1, 0);
+ else
+ prevkey = tmp;
sv_catpv(tmpsv, "\"");
switch (mp->mad_type) {
case MAD_NULL:
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;