[perl #35976] [PATCH] Add Unicode, Hex, and Octal escapes to Tcl

17 views
Skip to first unread message

Will Coleda

unread,
May 25, 2005, 8:27:34 PM5/25/05
to bugs-bi...@rt.perl.org
# New Ticket Created by Will Coleda
# Please include the string: [perl #35976]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=35976 >


The attached patch provides a (possibly naive) implementation of the remaining escape characters from:

http://www.tcl.tk/man/tcl8.5/TclCmd/Tcl.htm#M16

that were missing, namely

\ooo (octal)

\xhh (hex)

and

\uhhhh (unicode)

Supplied as a patch as I know someone's in the middle of working on the parser right now.

For this to *really* work, we need to be able to append ascii and unicode strings together with impunity. (Which *might* already work.)

tcl_escapes.patch

Leopold Toetsch

unread,
May 26, 2005, 2:17:45 AM5/26/05
to perl6-i...@perl.org, bugs-bi...@netlabs.develooper.com
Will Coleda (via RT) wrote:

> The attached patch provides a (possibly naive) implementation of the remaining escape characters from:

Withouht further looking: can't you use
src/string.c:string_unescape_cstring(), which has all these escapes already?

leo

William Coleda

unread,
May 26, 2005, 8:07:17 AM5/26/05
to Leopold Toetsch, perl6-i...@perl.org, bugs-bi...@netlabs.develooper.com
Because this appears to have been written primarily for perl implementors.

It does the following escapes:

1 \xhh 1..2 hex digits
2 \ooo 1..3 oct digits
3 \cX control char X
4 \x{h..h} 1..8 hex digits
5 \uhhhh 4 hex digits
6 \Uhhhhhhhh 8 hex digits
7-15 \a, \b, \t, \n, \v, \f, \r, \e, \?

Per:

http://www.tcl.tk/man/tcl8.5/TclCmd/Tcl.htm#M16

does 12 different backslash substitutions. While there is some substantial overlap, there are escapes I need that this doesn't provide, but worse, escapes you provide that I don't want.

Regards.

Matt Diephouse

unread,
May 27, 2005, 11:56:52 AM5/27/05
to perl6-i...@perl.org
Will Coleda <parrotbug...@parrotcode.org> wrote:
> The attached patch provides a (possibly naive) implementation of the remaining escape characters from:
>
> http://www.tcl.tk/man/tcl8.5/TclCmd/Tcl.htm#M16
>
> that were missing, namely
>
> \ooo (octal)
>
> \xhh (hex)
>
> and
>
> \uhhhh (unicode)
>
> Supplied as a patch as I know someone's in the middle of working on the parser right now.

That was me. I've just checked in this patch (slightly altered) as
part of my refactor (r8181). Thanks! :-)

--
matt diephouse
http://matt.diephouse.com

Reply all
Reply to author
Forward
0 new messages