REBOL 3.0

PARSE: what to do about ANY?

Carl Sassenrath, CTO
REBOL Technologies
2-Oct-2009 19:23 GMT

Article #0258
Main page || Index || Prior Article [0257] || Next Article [0259] || 6 Comments || Send feedback

This is a really old issue. There is a special case in parse that requires better definition. It occurs when you write rules like:

any [pos:]

The ANY word means accept 0 or more repetitions of the rule. But that block has no rule... so nothing fails. The question is: when does the loop stop?

One thing to note in the case above: the input series is not advancing. That is: we're not parsing anything, we're just looping.

So, we either need to require that users write:

any [pos: fail]

to avoid the infinite loop, or we must redefine ANY to accept 0 or more repetitions, as long as the input is advancing. Or, we just let it remain an infinite loop.

And, of course, this issue applies to more than just ANY.

Let me know your thoughts on this.

6 Comments

REBOL 3.0
Updated 25-Dec-2024 - Edit - Copyright REBOL Technologies - REBOL.net