# New Ticket Created by  Will Coleda 
# Please include the string:  [perl #29924]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=29924 >


Escaping quotes doesn't seem to work:

bash-2.05a$ cat quoting.imc 
.sub main @MAIN
  load_bytecode "library/Data/Escape.imc"
  .local string foo
  .local pmc escape
  escape = find_global "Data::Escape";, "String" 
  print "NONE:"
  foo = "\""
  foo = escape(foo)
  print foo
  print "\n"
  print "\":"
  foo = "\""
  foo = escape(foo,"\"")
  print foo
  print "\n"
  print "':"
  foo = "\""
  foo = escape(foo,"\'")
  print foo
  print "\n"
  end
.end

bash-2.05a$ ./parrot quoting.imc 
NONE:"
":\
':\'


None of which generate the escaped double quote I expected. The following patch:

bash-2.05a$ cvs diff library/Data/Escape.imc 
Index: library/Data/Escape.imc
===================================================================
RCS file: /cvs/public/parrot/library/Data/Escape.imc,v
retrieving revision 1.3
diff -u -r1.3 Escape.imc
--- library/Data/Escape.imc     17 May 2004 13:41:48 -0000      1.3
+++ library/Data/Escape.imc     28 May 2004 04:05:28 -0000
@@ -99,7 +99,7 @@
     # "
     ne char, '"', n34
     if c != 34 goto n34
-    set tmp, '\\"'
+    set tmp, "\\\""
     branch DONE
 n34:


Changes the output to the slightly more expected:

bash-2.05a$ ./parrot quoting.imc 
NONE:"
":\"
':\'





Reply via email to