Author: leo
Date: Tue Oct 25 12:42:02 2005
New Revision: 9565
Modified:
trunk/src/string.c
trunk/src/string_primitives.c
trunk/t/op/basic.t
Log:
pass through of plain chars after backslash
Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c (original)
+++ trunk/src/string.c Tue Oct 25 12:42:02 2005
@@ -2343,7 +2343,7 @@ Unescapes the specified C string. These
\x{h..h} 1..8 hex digits
\uhhhh 4 hex digits
\Uhhhhhhhh 8 hex digits
- \a, \b, \t, \n, \v, \f, \r, \e, \?
+ \a, \b, \t, \n, \v, \f, \r, \e
=cut
Modified: trunk/src/string_primitives.c
==============================================================================
--- trunk/src/string_primitives.c (original)
+++ trunk/src/string_primitives.c Tue Oct 25 12:42:02 2005
@@ -169,9 +169,9 @@ string_unescape_one(Interp *interpreter,
UINTVAL len = string_length(interpreter, string);
/* Well, not right now */
codepoint = CHARSET_GET_BYTE(interpreter, string, *offset);
+ ++*offset;
switch (codepoint) {
case 'x':
- ++*offset;
codepoint = CHARSET_GET_BYTE(interpreter, string, *offset);
if (codepoint >= '0' && codepoint <= '9') {
workchar = codepoint - '0';
@@ -226,7 +226,6 @@ string_unescape_one(Interp *interpreter,
++*offset;
return workchar;
case 'c':
- ++*offset;
codepoint = CHARSET_GET_BYTE(interpreter, string, *offset);
if (codepoint >= 'A' && codepoint <= 'Z') {
workchar = codepoint - 'A' + 1;
@@ -236,7 +235,6 @@ string_unescape_one(Interp *interpreter,
++*offset;
return workchar;
case 'u':
- ++*offset;
workchar = 0;
for (charcount = 0; charcount < 4; charcount++) {
if (*offset < len) {
@@ -260,7 +258,6 @@ string_unescape_one(Interp *interpreter,
}
return workchar;
case 'U':
- ++*offset;
workchar = 0;
for (charcount = 0; charcount < 8; charcount++) {
if (*offset < len) {
@@ -283,8 +280,6 @@ string_unescape_one(Interp *interpreter,
++*offset;
}
return workchar;
- case 'b':
- internal_exception(UNIMPLEMENTED, "Illegal escape sequence in ");
case '0':
case '1':
case '2':
@@ -294,7 +289,6 @@ string_unescape_one(Interp *interpreter,
case '6':
case '7':
workchar = codepoint - '0';
- ++*offset;
if (*offset < len) {
workchar *= 8;
codepoint = CHARSET_GET_BYTE(interpreter, string, *offset);
@@ -321,35 +315,28 @@ string_unescape_one(Interp *interpreter,
++*offset;
return workchar;
case 'a':
- ++*offset;
return 7; /* bell */
+ case 'b':
+ return 8; /* bs */
case 't':
- ++*offset;
return 9;
case 'n':
- ++*offset;
return 10;
case 'v':
- ++*offset;
return 11;
case 'f':
- ++*offset;
return 12;
case 'r':
- ++*offset;
return 13;
case 'e':
- ++*offset;
return 27;
case 92:
- ++*offset;
return 92;
case '"':
- ++*offset;
return '"';
}
- return 0;
+ return codepoint; /* any not special return the char */
}
/*
Modified: trunk/t/op/basic.t
==============================================================================
--- trunk/t/op/basic.t (original)
+++ trunk/t/op/basic.t Tue Oct 25 12:42:02 2005
@@ -18,7 +18,7 @@ Tests basic string and branching operati
use strict;
-use Parrot::Test tests => 22;
+use Parrot::Test tests => 23;
# It would be very embarrassing if these didnt work...
output_is(<<'CODE', '', "noop, end");
@@ -61,6 +61,11 @@ output_is(<<'CODE', q(Parrot flies), "pr
end
CODE
+output_is(<<'CODE', q(Parrot flies), "escaped non-special");
+ print "Parrot fl\ies"
+ end
+CODE
+
output_is(<<'CODE', <<OUTPUT, "print string with embedded newline");
print "Parrot flies\n"
end