[REBOL] Re: Parse versus Regular Expressions
From: tomc:darkwing:uoregon at: 8-Apr-2003 1:10
not as bad it it looks at first
digit: charset {0123456789}
digits: [some digit]
cur-seq: copy/part find buf "^/" -8
sentence: copy ""
parse buf [
some[ (flag: false)
digits opt["*" (flag: true)] copy string to newline newline
( seq: copy/part tail string -8
string: trim head clear find/last string seq
either seq = cur-seq
[either flag [sentence: copy ""][append sentence join " " [string]]]
[either seq > cur-seq
[print sentence sentence: string cur-seq: seq]
[print rejoin["ERROR " seq if flag ["* "] string] sentence: copy ""]
]
)
](print sentence)
]
On Fri, 4 Apr 2003, Joel Neely wrote: