> Clint brought a small assembler string but to my attention, and I found > another bug while fixing the first. Bugs were: > a) 'a"b"c' was turned into 'a[sc:1]c' before being turned into [sc:2] > b) 'a\"b' was printing being stored as a\"b and not a"b
There was some discussion about this, but nothing was resolved. Who's holding the ball here? Am I supposed to go and implement some other quoting behavior, or is the quoting behavior still being considered, or was it forgotten entirely? :) Regardless of what we decide about quoting behavior, there is still the first bug mentioned above. Thanks, Mike Lambert > Index: lib/Parrot/Assembler.pm > =================================================================== > RCS file: /cvs/public/parrot/lib/Parrot/Assembler.pm,v > retrieving revision 1.20 > diff -u -r1.20 Assembler.pm > --- lib/Parrot/Assembler.pm 10 Mar 2002 21:15:50 -0000 1.20 > +++ lib/Parrot/Assembler.pm 16 Apr 2002 17:32:55 -0000 > @@ -679,8 +679,7 @@ > sub replace_string_constants { > my $code = shift; > > - $code =~ s{([NU])?"(((\\")|[^"])*)"}{constantize_string($2, $1)}egx; > - $code =~ s{([NU])?'(((\\')|[^'])*)'}{constantize_string($2, $1)}egx; > + $code =~ s{([NU]?)(["'])((?:(?:\\\2)|(?!\2).)*)\2}{constantize_string($3, >$1)}egx; #" > > return $code; > } > @@ -1371,7 +1370,9 @@ > 'n' => "\n", > 'r' => "\r", > 't' => "\t", > - '\\' => '\\' > + '\\' => '\\', > + '"' => '"', > + "'" => "'", > ); > > sub constantize_string { > @@ -1384,7 +1385,7 @@ > > $s=~s/\\(0\d*)/chr(oct($1))/eg; > $s=~s/\\x([0-9a-fA-F]{1,2})/chr(hex($1))/ge; > - $s=~s/\\([anrt\\])/$escape{$1}/ge; > + $s=~s/\\([anrt\\'"])/$escape{$1}/ge; #" > > if(!exists($constants{$s}{s}{$e})) { > push(@constants, ['s', $s, $e]); > Index: t/op/string.t > =================================================================== > RCS file: /cvs/public/parrot/t/op/string.t,v > retrieving revision 1.19 > diff -u -r1.19 string.t > --- t/op/string.t 14 Mar 2002 18:45:22 -0000 1.19 > +++ t/op/string.t 16 Apr 2002 17:32:55 -0000 > @@ -1,6 +1,6 @@ > #! perl -w > > -use Parrot::Test tests => 64; > +use Parrot::Test tests => 65; > > output_is( <<'CODE', <<OUTPUT, "set_s_s|sc" ); > set S4, "JAPH\n" > @@ -797,6 +797,22 @@ > end > CODE > > +output_is(<<CODE, <<OUTPUT, "assembly_string_constants"); > + set S0, "aa'bb'cc\\n" > + set S1, "aa\\"bb\\'cc\\n" > + set S2, 'aa"bb"cc\\n' > + set S3, 'aa\\'bb\\"cc\\n' > + print S0 > + print S1 > + print S2 > + print S3 > + end > +CODE > +aa'bb'cc > +aa"bb'cc > +aa"bb"cc > +aa'bb"cc > +OUTPUT > > # Set all string registers to values given by &$_[0](reg num) > sub set_str_regs { > > >