[REBOL] Re: Newbie Parse Problem!
From: lmecir:mbox:vol:cz at: 3-Jul-2002 23:09
Hi Gary,
<<Gary>>
...
I have the following code fragment.
All I get at the end is false.
After reading the manual examples it seems as if I should
at get 1, 2 and 3 printed. I'm not even getting 1!
I'm obviously missing something.
==================
UserInput: "hello there!"
punctuation: charset [#"," #"." #"/" #"\" #"!"]
parse UserInput [
to "hello" | "hi" | "howdy" {print 1}
to "there" | punctuation {print 2}
to punctuation {print 3}
]
<</Gary>>
if you write something like:
do http://www.rebolforces.com/~ladislav/parseen.r
parse/all UserInput reduce [
to-rule ["hello" | "hi" | "howdy"] first [(print 1)]
to-rule ["there" | punctuation] first [(print 2)]
to-rule [punctuation] first [(print 3)]
]
, you will get the result:
1
2
3
== false
Is that what you wanted?
-L