[EMAIL PROTECTED] wrote:
>
> EAT, I think this is what you need:
>
> headrule: [
> some [
> thru "=== " copy head to newline (
> append head " (FIRST LEVEL)" append full-contents head
> )
> |
> thru "--- " copy head to newline (
> append head " (SECOND LEVEL)" append full-contents head
> )
> ]
> ]
This is one of the methods I'd tried that parsed only the first level
but not the second. However, during the day I chatted with a
REBOL-savy friend of mine who was rather intrigued at the challenge of
what I was trying to do. He played with it for a bit and came up with
the answer.
The answer is to track series travels with word: and dereference the
location where you want to evaluate some expressions with :word. Seems
a lot of my troubles came from wanting to use 'thru', or 'to' in a way
they couldn't be used, also. Seems to me there might be room to
improve upon the documentation here as well, it's unclear where 'thru'
and 'to' limitations are by reading the docs.
In anycase, here's the solution I ended up with. A modification of
my friend's suggestion. What I wanted to do was evaluate a different
set of expressions depending on which set of characters was found in
a series. Basically, while I love switch, not use switch as it's not
efficient within the parse mechanism. Especially, knowing parse had
the capability, I wanted to use parse's conditional evaluation and try
to stick to the philosophy of REBOL's elegance.
If anyone can think of a way to refine the following, I love
suggestions:
rule: [
mark:
"=== " :mark thru "=== " copy header to newline
(append header " (FIRST LEVEL)"
append full-contents header) |
"--- " :mark thru "--- " copy header to newline
(append header " (SECOND LEVEL)"
append full-contents header) |
thru newline
]
It's worth noting my attempts to put 'thru" just after mark: and
before the target string resulted in errors with append's attempts
to insert header into full-contents... However, by "backing up"
to :mark once a set of character's was located and THEN going 'thru'
the set of characters I had originally sought allowed me to prevent
the sought after set of characters from being included in the copy
to header. This is the most graceful way I could figer out. If
anyone can think of a better way, I'm all eyes.
Meanwhile, I still can't figure out how Carl's example was able
to work as claimed without using the word: :word mechanism. If
anyone has the answer to this mystery, I'd love to see it. Please,
no theories, but the concrete answer to the riddle. Theories lose
me while concrete explainations don't.
Cheerfulness,
-----EAT