rebol/rebol — pull request #169 by hostilefork (2013-10-04 19:59:25+00:00)
Title: PARSE evals functions and closures to produce rules (CC #2075)

This could well not be quite right, but that's why I'm submitting it for review. It appears to basically work.

I noticed that in order to use Do_Next, the point of invocation needed to pass in a series and an index. Parse didn't have the actual REBSER on hand once you got into the guts of it... it was passed the VAL_BLK_DATA and then iterated to the end of it. So most of the change was just adding it to the function interfaces as `rules_block`. To avoid confusion I then renamed `rules` to just `rule`.

I'm a little confused about stack handling and lifetimes of the generated results by Do_Next, and how safe this is w.r.t. garbage collection and volatility. I also don't know if the existing routines which seemed to put things on the top of the stack and then read them with DS_TOP, without ever doing a DS_POP, are actually leaking things onto the stack memory.

So some eyes on this will definitely help.