Parsing a README.md File To Fill A Folder

As an interesting talking point... I originally wrote this as:

collect some [
   keep ["*" space url! elide newline]
   | thru newline
 ]

It came naturally to write that using ELIDE. I was going to brag about how cool I thought that was.

Then I thought: "Oh, silly me, I could have just made the KEEP span the URL!" So it didn't seem so cool after all.

..but... it is cool!

What's notable is that with the ELIDE, you're able to easily make the URL! the product of the rule in a reusable way.

value-bearing-rule: ["*" space url! elide newline]

uparse data [ 
    ...
    keep value-bearing-rule
    ...
]

So you can use it with KEEP or with other things.

ELIDE is an assistant in the question asked long ago about how to reuse rules. It may not be a fit for a case like what I was writing, but you can see how a slightly different case it would be useful for.

What About '* vs "*"

If you're parsing text, I think it does keep it cleaner if you use the apostrophe That's 3 less ticks!

Where this might get a bit questionable is if you've picked to define * as some kind of meaningful combinator in UPARSE. Having more ticks might be a benefit to distinguish it.

Or maybe not? I guess it all depends on whether you're using syntax highlighting that calls out the QUOTED!s, or your personal preference.

Main Point: There's Power Here You Won't Find Elsewhere

UPARSE has taken Rebol's cool (but long in the tooth) model to where it's Insaneo Style. I think it's only going to keep getting better.

1 Like