diff options
author | David Mitchell <davem@iabyn.com> | 2018-01-12 14:35:03 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2018-01-19 13:45:20 +0000 |
commit | c923a6996655868e1b5140e8e47c2514e006902b (patch) | |
tree | 478522fa941fcf2da9abec08ccdc9ec937f679f4 /lib | |
parent | c1048fcffff9a2b16ece33136c56febc7e5e4396 (diff) | |
download | perl-c923a6996655868e1b5140e8e47c2514e006902b.tar.gz |
B, Deparse fixups for tr///c
Recent commits slightly changed the layout of the extended map table: it
now always stores a repeat count, and there are now two structs defined,
rather than treating certain slots, like tbl[0x101], specially.
Update B and Deparse to reflect this.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/B/Deparse.pm | 5 | ||||
-rw-r--r-- | lib/B/Deparse.t | 14 |
2 files changed, 17 insertions, 2 deletions
diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm index 86f262acf1..5fc3d02e1f 100644 --- a/lib/B/Deparse.pm +++ b/lib/B/Deparse.pm @@ -5607,8 +5607,9 @@ sub collapse { sub tr_decode_byte { my($table, $flags) = @_; - my(@table) = unpack("s*", $table); - splice @table, 0x100, 1; # Number of subsequent elements + my (@table) = unpack("s256sss*", $table); + my ($excess_len, $repeat_char) = splice(@table, 256, 2); + my($c, $tr, @from, @to, @delfrom, $delhyphen); if ($table[ord "-"] != -1 and $table[ord("-") - 1] == -1 || $table[ord("-") + 1] == -1) diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 00fbb01cf8..cbee5427a8 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -1444,6 +1444,20 @@ tr/X//d; tr/X//s; tr/X//r; #### +# tr with extended table (/c) +tr/\000-\375/AB/c; +tr/\000-\375/A-C/c; +tr/\000-\375/A-D/c; +tr/\000-\375/A-Z/c; +tr/\000-\375/AB/cd; +tr/\000-\375/A-C/cd; +tr/\000-\375/A-D/cd; +tr/\000-\375/A-Z/cd; +tr/\000-\375/AB/cds; +tr/\000-\375/A-C/cds; +tr/\000-\375/A-D/cds; +tr/\000-\375/A-Z/cds; +#### # [perl #119807] s//\(3)/ge should not warn when deparsed (\3 warns) s/foo/\(3);/eg; #### |