[REBOL] Re: parsing..
From: krobillard:san:rr at: 8-Jan-2005 15:08
Eric,
Take a look at chapter 15 of the Users Guide
(http://rebol.com/docs/core23/rebolcore.html).
Use 'some' to continually read the input.
Rebol parse is more verbose than regexps (and by the looks of it, Rexx parse)
but it's not too bad. Here's an example:
----------------------------
input-line: "ghi 22 abc hello"
v1: v2: v2: none
blk: parse input-line none ; convert to block form first
parse blk [some[
"abc" set v1 string!
| "def" set v2 string!
| "ghi" set v3 string!
]]
print [v1 v2 v3] ; hello none 22
----------------------------
If your input format is fixed then you won't need 'some' and this might work
for you:
----------------------------
input-line: "abc hello def true ghi 22"
blk: parse input-line none
parse blk [ "abc" set v1 string! "def" set v2 string! "ghi" set v3 string! ]
print [v1 v2 v3]
----------------------------
-Karl
On Saturday 08 January 2005 13:04, Eric Haddix wrote: