[REBOL] Re: Re(2): Matching RE's - pattern matching
From: d4marcus::dtek::chalmers::se at: 24-Mar-2001 19:07
On Sat, 24 Mar 2001, Anton wrote:
> I want to check out your recurse as well.
> It's neater than my tree. I implemented
> a stack for mine. :)
I have made a tree function as well, which of course uses a stack too.
Btw, this tree function is actually made of two functions, one called
tree-builder and one called tree-parser. The tree function the looks like
this:
set 'Tree func ["Print directory tree"
dir [file! unset!] "Directory to list"
] [
any [value? 'dir dir: %.] tree-init
tree-parser tree-builder dir ()]
tree-init initialises the rules to use when parsing the tree. This way you
can easily make several function with various effects, like cloning a
directory structure, running all scripts matching .r etc...
Eventually tree-builder will be able to take patterns too, like recurse
does, but without paths like */* becuase paths make no sense for tree.
> I think it could be time to write our own
> matching parse rules. I was thinking this
> already but never got around to it.
It would be good enough just being able to translate "?*" to some
'parse rule.
Marcus
------------------------------------
If you find that life spits on you
calm down and pretend it's raining