Changeset 21569
- Timestamp:
- 07/27/08 16:19:34 (5 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
perl5/Pugs-Compiler-Perl6/lib/Pugs/Emitter/Perl6/Perl5.pm
r21564 r21569 27 27 $s = $n->{$_} if exists $n->{$_}; 28 28 } 29 29 30 30 #print "get: $s\n"; 31 31 32 32 if ( defined $s 33 33 && $s =~ /\$\? .* POSITION $/x … … 174 174 return "q!$n!" unless $n =~ /[!]/; 175 175 return "q^$n^" unless $n =~ /[\^]/; 176 die "can't quote string [$n]"; 177 } 178 179 sub _emit_qr { 180 my $n = $_[0]; 181 return "qr($n)" unless $n =~ /[()]/; 182 return "qr{$n}" unless $n =~ /[{}]/; 183 return "qr[$n]" unless $n =~ /[\[\]]/; 184 return "qr!$n!" unless $n =~ /[!]/; 185 return "qr^$n^" unless $n =~ /[\^]/; 176 186 die "can't quote string [$n]"; 177 187 } … … 1021 1031 1022 1032 if ( exists $n->{rx} ) { 1023 return 'qr{'.$n->{rx}{rx}.'}' if $n->{rx}{options}{perl5}; 1033 return _emit_qr( $n->{rx}{rx} ) if $n->{rx}{options}{perl5}; 1034 return _emit_qr( $n->{rx}{rx} ) # TODO: perl6rx\n"; 1024 1035 } 1025 1036 … … 1068 1079 exp1 => { scalar => '$_' }, 1069 1080 exp2 => $n->{exp1}, 1070 op1 => { op => '~~' },1081 op1 => '~~', 1071 1082 fixity => 'infix', 1072 1083 } … … 1459 1470 } 1460 1471 if ( my $rx = $n->{exp2}{rx} ) { 1461 if ( !$rx->{options}{perl5} ) {1472 if ( !$rx->{options}{perl5} && !$rx->{options}{p5} ) { 1462 1473 my $regex = $rx->{rx}; 1463 1474 # XXX: hack for /$pattern/
