There was an old dialect that used blocks, like:
sources-C: [
%file1.c
[%file2.c <some> <options>]
%file3.c
]
This was because it was based on MAP-EACH and processing items seemed "easier" to do when you could go one item at a time.
But I decided I didn't like it. I prefer to have the option blocks separate. I'm also going back to accepting TUPLE!s/PATH!s (a bootstrap issue got in the way of this, but I found a workaround).
sources-C: [
file1.c
file2.c [<some> <options>]
file3.c
]
Traversing this means you have to do some PARSE-ing, but that's what makes it interesting.
Here's some code that's getting tossed, that did some "canonicalizing" of the old format:
; Some places (like SOURCES: in %make-spec.r for extensions) are permissive
; in terms of their format:
;
; sources-A: %file.jpg
;
; sources-B: [%file.jpg <some> <options>]
;
; sources-C: [
; %file1.jpg
; [%file2.jpg <some> <options>]
; %file3.jpg
; ]
;
; It's a bit irregular, but convenient. This function regularizes it:
;
; sources-A: [
; [%file.c]
; ]
;
; sources-B: [
; [%file.c <some> <options>]
; ]
;
; sources-C: [
; [%file1.c]
; [%file2.c <some> <options>]
; [%file3.c]
; ]
;
export to-block-of-file-blocks: func [
return: "Will be a top-level COPY of the block, or new block"
[block!]
x [<opt> file! block!]
][
if file? x [
return reduce [blockify x] ; case A
]
any [null? x, x = []] then [
return copy []
]
if file? x.1 [
all [
not find (next x) file!
not find (next x) block!
] then [
return reduce [x] ; case B
]
; fallthrough
]
if find x tag! [ ; light check for mistakes
panic [
"FILE!/BLOCK! list can't contain TAG!s if multiple files:"
mold:limit x 200
]
]
return map-each 'item x [blockify item] ; case C
]