comparison man/lispref/objects.texi @ 4265:dc697b1b786f

[xemacs-hg @ 2007-11-14 18:20:41 by aidan] Document how one can include a trailing backslash in a raw string.
author aidan
date Wed, 14 Nov 2007 18:20:42 +0000
parents c136144fe765
children 2d39535e1f9d
comparison
equal deleted inserted replaced
4264:9db20cbbe4c7 4265:dc697b1b786f
1082 An alternative syntax allows insertion of raw backslashes into a 1082 An alternative syntax allows insertion of raw backslashes into a
1083 string, like this: @code{#r"this \ is an embedded backslash"}. In such 1083 string, like this: @code{#r"this \ is an embedded backslash"}. In such
1084 a string, each character following a backslash is included literally in 1084 a string, each character following a backslash is included literally in
1085 the string, and all backslashes are left in the string. This means that 1085 the string, and all backslashes are left in the string. This means that
1086 @code{#r"\""} is a valid string literal with two characters, a backslash and a 1086 @code{#r"\""} is a valid string literal with two characters, a backslash and a
1087 double-quote. It also means that a string with this syntax @emph{cannot end 1087 double-quote. It also means that a string with this syntax cannot end
1088 in a single backslash}. As with Python, from where this syntax was 1088 in a single backslash. As with Python, from where this syntax was
1089 taken, you can specify @code{u} or @code{U} after the @code{#r} to 1089 taken, you can specify @code{u} or @code{U} after the @code{#r} to
1090 specify that interpretation of Unicode escapes should be done. 1090 specify that interpretation of Unicode escapes should be
1091 done---@pxref{Character Type}---and if you use @code{#ru} for your raw
1092 strings, the restriction on the trailing backslash can be worked around
1093 like so: @code{#ru"Backslash: \u005C"}.
1091 1094
1092 The newline character is not special in the read syntax for strings; 1095 The newline character is not special in the read syntax for strings;
1093 if you write a new line between the double-quotes, it becomes a 1096 if you write a new line between the double-quotes, it becomes a
1094 character in the string. But an escaped newline---one that is preceded 1097 character in the string. But an escaped newline---one that is preceded
1095 by @samp{\}---does not become part of the string; i.e., the Lisp reader 1098 by @samp{\}---does not become part of the string; i.e., the Lisp reader