Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Parse and and recursion local variables?

From: petr:krenzelok:trz:cz at: 20-Mar-2007 7:41

Maxim Olivier-Adlhoch wrote:
> btw, > > what people do not immediately see is that to and thru do not match rules, > they only "match" charsets or strings, they really are like find and > find/tail . > > actually, to and thru really only skip content, they don't match it. which > is a big difference with the rest of parse which must match it. Which is > why parsing is so hard. one must identify all the patterns which can match, > often innwards out . I too, was tempted into using to and thru when I > started... but I quickly understood that I could not go very far with parse, > and in fact, probably one of the reasons I eventually didn't get to use it. >
Max, what do you mean by "only skip content"? I am not C guru, but how actually do you think, that 'find works? IMO it HAS TO check each char of unindexed content, to find out, if the string you search for is contained in the searched string, no? And if so, it actually works in the "match" way anyway? The obstacle of to/thru is exactly the lack of lowest index match returned first. Becase if you search [[to "some string" | to "other string"]], you usually want to stop at the lowest index, whereas such rule would apply for whatever "some string" occurence. Now who says, that to/thru [a | b | c] should work 3x 'find way internally? My understanding is, that you expect that you think it would do index? find a, index? find b, index? find c, find minimum of indexes, returning such rule as a match. So yes, here it is a slow down, because if the string will be long, and you will have many options to search for, it can get slow. But, why should it necessarily work that way? Internally it could work [a | b | c | skip] way, no? Or am I missing something? PS: I would like some official places (Carl, Gabriele, Ladislav) to tell us, what is planned for parse. In fact, I started this thread to raise the community voice, because I think this topi was raised in 2001 already? However, I am not sure ML is not kind of dead channel to RT, du not remember when last Carl was here, so not sure if RT tracks it. But at least this topic is covered here, so users can search it on, which is always good ... Petr