REBOL3 tracker
  0.9.12 beta
Ticket #0001415 User: anonymous

Project:



rss
TypeBug Statustested Date3-Jan-2010 16:48
Versionalpha 95 CategorySyntax Submitted bymeijeru
PlatformWindows Severityminor Prioritynormal

Summary Inconsistency in handling of ^ in file literals
Description This is about ^ in file literals which are not specified using %"...".

The occurrence of a single ^ in a file literal is not forbidden by the lexical scanner. TO-FILE works as expected, producing a genuine ^ sign. TO-STRING introduces a carriage return (U+000D) perhaps as a result of "annexating" the end-of-line, but LOAD sees U+0000 instead!
Example code
>> to-file "^^"
== %^
>> to-binary to-string to-file "^^"
== #{5E} ;; just to prove it is a genuine ^
>> to-string %^
== "^M" ;; where does this come from?
>> load "%^^"
== %%00

Assigned ton/a Fixed inalpha 97 Last Update8-Feb-2010 03:10


Comments
(0001890)
meijeru
3-Jan-2010 17:08

In fact, the molding of to-file "^^" as %^ might be the one in error, perhaps it should be %^^ ! Indeeed to-string %^^ is "^^" and load "%^^^^" gives a file literal consisting of a single ^.
(0001950)
Carl
4-Feb-2010 14:21

The example code should generate an error and now does... because we can consider a ^ without anything after it to be an error.

However, it is likely that there are other issues lurking here. A file name in a string is a string in a string, so the escapes get doubled. This still needs some testing and perhaps discussion.

Date User Field Action Change
8-Feb-2010 03:10 BrianH Status Modified built => tested
4-Feb-2010 14:21 carl Fixedin Modified => alpha 97
4-Feb-2010 14:21 carl Status Modified reviewed => built
4-Feb-2010 14:21 carl Comment : 0001950 Added -
12-Jan-2010 21:04 carl Description Modified -
12-Jan-2010 21:04 carl Code Modified -
12-Jan-2010 21:04 carl Status Modified submitted => reviewed
3-Jan-2010 17:09 meijeru Comment : 0001890 Modified -
3-Jan-2010 17:08 meijeru Comment : 0001890 Added -
3-Jan-2010 16:48 meijeru Ticket Added -