Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Avoid nqp::escape for SVal encoding.
It does all sorts of things that need all sorts of untangling...
  • Loading branch information
jnthn committed Feb 27, 2013
1 parent ce56d86 commit 289ad59
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/JAST/Nodes.nqp
Expand Up @@ -253,7 +253,21 @@ class JAST::PushSVal is JAST::Node {
}

method value() { $!value }
method dump() { ".push_sc " ~ nqp::escape($!value) }
method dump() {
my @chars := nqp::split('', $!value);
my int $i := 0;
my int $n := nqp::elems(@chars);
my $c;
while $i < $n {
$c := nqp::atpos(@chars, $i);
if $c eq "\\" { @chars[$i] := "\\\\"; }
elsif $c eq "\n" { @chars[$i] := "\\n"; }
elsif $c eq "\r" { @chars[$i] := "\\r"; }
elsif $c eq "\t" { @chars[$i] := "\\t"; }
$i++;
}
".push_sc " ~ nqp::join('', @chars)
}
}

class JAST::PushCVal is JAST::Node {
Expand Down

0 comments on commit 289ad59

Please sign in to comment.