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

[REBOL] Re: 'Parse is peculiar! - more details

From: brett:codeconscious at: 14-Dec-2000 22:36

> L 09/22/2000 - 15:37:25: "*`Ultimate_Master`*<4718>" <WON:26073391>"
connected, ip
> "202.54.232.2" > L 09/22/2000 - 15:43:10: "[IMPREA]Smart-Gun!!<4723><WON:23014199>"
connected, ip
> "220.34.24.3" > L 09/22/2000 - 15:47:30: "{[FrAg]}-MaN-<4727><WON:19220729>" connected, ip
132.76.43.24
> L 09/22/2000 - 15:49:22: "<Usyd> H4XX0R<124><WON:20007739>" connected, ip
160.34.64.112
> As you can see the game appears to impose few restrictions on the range of
characters and
> spaces allowed in a name. It's also a stupid log format.
Hmm. I agree really ugly log format... It really isn't the best example for getting confident on parse. But I can see it would be really good to get it to work :)
>Therefore I need the > following behavoir from 'parse: > > go thru {"} then copy all text to name until the UID pattern "< some
digits >" is found.
> I don't want the UID included in 'name though. In the lines above that
would mean 'name
> is set to "*`Ultimate_Master`*", "[IMPREA]Smart-Gun!!", "{[FrAg]}-MaN-"
and "<Usyd>
> H4XX0R" respectively. > > I don't want to go thru the UID I want to go 'to it, but still get a 'true
result. Is that log line you gave for Ultimate_Master accurate? There seems to be a double-quote after the UID. The problem that I can see is that somebody might have a name like <4444>. They might get really wierd and do something like <4444><4444> as a name as well. The only consistency I can see for determining what is really after the name is the string that starts <WON: So I reckon on the basis of what I've seen, the only way to get the name accurately is to find the UID accurately and to do that requires searching backwards from before the <WON: for a <UID>. The problem here is parse won't do this neatly in one go. One idea then is to get parse to caputure from the beginning of the name throught to the <WON and then call itself to process the internal bit - my worry with this is to know if parse is reenterant or not. Or better use parse to do as before but instead of calling itself, use find instead. I know you are trying to avoid find, but it may actually be the simplest to code and understand. Alternatively you could probably get parse to backtrack in a fashion by creating a truly evil parse rule. I managed to do this once but as I said - it is truly evil (modifies the input stream and other horrors). :) Anyway I'll wait to hear your thoughts and to find out if that double-quote was real or not. Brett.