[REBOL] pinging SELMA Re:
From: brian:hawley:bigfoot at: 19-Sep-2000 21:20
Jeff wrote:
> BTW: Anyone made any improvements to SELMA that they would
> like to share?
>
> -jeff
Now that you mention it, here's a suggestion that I majáÜ–n
February 1 to fix SELMA. There is a long-standing bug in the
parse native in all versions of REBOL that affects the code
in SELMA that parses subject lines. I've reported this bug
to Feedback a few times. The parse bug still stands in all
current (and experimental) versions that I have tested.
Here's the last message that I sent on the subject:
------------------------------------------------------------
I found a bug in parse that affects the Repost function
in the Selma source. I'll tell you more about the bug
after I can do a little more analysis. There was also
a potentially crash-causing call to to-integer for some
subject lines, and "[REBOL]" used instead of list-tag.
This will fix the Repost function:
Repost: func [message /local here there re-cnt] [
re-cnt: 0
parse message/subject [
some [
to "re:" here: 3 skip [
"(" copy num digits ")" (
if num [re-cnt: re-cnt + to-integer trim num]
) | none (re-cnt: 1 + re-cnt)
] any " " there: (remove/part here there) :here
]
]
parse message/subject [
here: any list-tag any " " there:
(remove/part here there) :here
]
insert tail trim message/subject " Re:"
if re-cnt > 1 [
insert tail message/subject reduce ["(" re-cnt ")"]
]
post message
]
While you're at it, the parse rule in Process-Mail,
[thru "re:" list-tag] can be changed to [thru "re:"] .
This should work for the [ALLY] list as well.
------------------------------------------------------------
...And here's some code that demonstrates the parse bug,
that I also sent to Feedback:
-----------------------------------------------------------[
REBOL [
Title: "Parse bug demonstration"
Author: "Brian Hawley"
Email: [brian--hawley--bigfoot--com]
Date: 3-Feb-2000
]
; First, with optional one "a"
y-cnt: 0
parse a: "y a a y z" [
some [
to "y" here: "y"
0 1 "a" ; Note only one "a" optional here
any " " there:
(y-cnt: 1 + :y-cnt remove/part :here :there) :here
] ; This block should run twice, and does
]
print [mold a y-cnt {(should be "a z" 2)}]
; Second, with optional more than one "a"
y-cnt: 0
parse a: "y a a y z" [
some [
to "y" here: "y"
0 2 "a" ; Note more than one "a" optional here
any " " there:
(y-cnt: 1 + :y-cnt remove/part :here :there) :here
] ; This block should run twice, but doesn't
]
print [mold a y-cnt {(should be "z" 2)}]
comment {
This error shows up when you use any form to express
wanting multiple "a", including [0 n "a"], [some "a"]
and [any "a"]. I haven't found any dependency on which
letters you are searching for or how many, at least in
this example.
You know, if I had the source to parse I could figure
this out for you, hint, hint :).
}
]-----------------------------------------------------------
I hope that this helps.
Brian Hawley