REBOL [
Title: "Load Junk"
Date: 7-Jan-2009
Author: "Christopher Ross-Gill"
Exports: [load-junk]
]
load-junk: use [chars space][
chars: complement space: charset " ,^/^-"
func [text [string!] /local out val junk][
out: copy []
junk: copy ""
while [not tail? text][
either attempt [set [val text] load/next text][
unless empty? junk [append out junk junk: copy ""]
append out val
][
parse text [
any space copy val some chars any space text:
(junk: reform [junk val])
]
]
]
unless any [empty? junk junk == last out][append out junk]
out
]
]