[REBOL] Re: adding line hints when building blocks
From: ingo:2b1 at: 25-May-2002 8:03
Hi Gregg,
Gregg Irwin wrote:
> hi Ammon,
>
> << Just a shot in the dark (I am still not sure what you are attempting, an
> example maybe?) Have you tried placing the word 'newline in where you
> wanted
> a new line? and I think that there is a similar one for tab IIRC. >>
>
> Yup. Tried various combinations of things, reducing, composing, etc. but no
> luck so far.
>
> The goal is to write out, to a file, something like this:
>
> item-1-id [
> value 0
> mail [foo--bar--com]
> ]
>
> item-2-id [
> value 1
> mail [foo--baz--com]
> ]
I guess writing a pretty printer is your only chance, maybe something
like this will do:
a: [item-1-id [value 0 mail [foo--bar--com]] item-2-id [value 1 mail
[foo--baz--com]]]
parse a [
some [
set id word! (print [id "["])
into [
some [
set name word!
set val any-type!
(print [ " " name val ])
]
(print "]")
]
]
]
which gives
item-1-id [
value 0
mail [foo--bar--com]
]
item-2-id [
value 1
mail [foo--baz--com]
]
I hope that helps,
Ingo