Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Yet another parse problem or bug?

 [1/2] from: cyphre::seznam::cz at: 31-Oct-2001 10:59


Hello all, try this: --------snip---------- test: {line 1 line 2 "line 3" line 4} parse/all test "^/" ----------snip--------- the result is: ["line 1" "line 2" { "line 3"} "line 4"] why the result doesnot looks like this: ["line 1" {"line 2"} { "line 3"} "line 4"] I don't want to use: parse/all test [some [copy t to "^/" (probe t) skip]] Maybe bug in parse? Anyone? regards, Cyphre

 [2/2] from: joel:neely:fedex at: 31-Oct-2001 6:26


Hi, Cyphre, I reported some oddities with PARSE and quotation marks quite a while back, but never received any explanation. AFAICT it's a bug, since it violates the reasonable (IMHO) interpretation of what RCUG says about the behavior of PARSE/ALL. One problem (I haven't done exhuastive testing) appears to relate to the specific case of an embedded quotation mark immediately following a delimiter, as in your example's line 2, and the following:
>> test2: "line 1#^"line 2^"# ^"line 3^"#line 4"
== {line 1#"line 2"# "line 3"#line 4}
>> parse/all test2 "#"
== ["line 1" "line 2" { "line 3"} "line 4"] which indicates to me that the bug is not specific to {} nor "^/". I ran into this issue trying to work with comma-delimited ASCII files, as produced by certain nameless spreadsheets. ;-) Please see http://www.escribe.com/internet/rebol/m2097.html for the code I came up with as a solution to the PARSE/ALL behavior in that context. Incidentally, what appears to be the same bug in a different guise afflicts the content of SYSTEM/SCRIPT/ARGS, as shown by this test: 8<---------------------------------------- REBOL [] blort: system/script/args source blort blort: system/options/args source blort ask "Done?" 8<---------------------------------------- which, when run by rebol ssargs.r foo "blab yakk woot!" combo.r -t10 /nope=0 produces the console output blort: "foo blab yakk woot! combo.r -t10 /nope=0" blort: ["foo" "blab yakk woot!" "combo.r" "-t10" "/nope=0"] Done? Destroying the quotation marks when presenting all args as a single string, of course, eliminates the scripts ability to distinguish string args from file names, options, etc... HTH! -jn- Cyphre wrote:
> Hello all, > try this:
<<quoted lines omitted: 23>>
> [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- ; sub REBOL {}; sub head ($) {@_[0]} REBOL [] # despam: func [e] [replace replace/all e ":" "." "#" "@"] ; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"} print head reverse despam "moc:xedef#yleen:leoj" ;

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted