[DGD] Reasonable Tick Counts?

Kurt Nordstrom kurt at blar.net
Mon Jul 9 03:32:45 CEST 2007


My current code does the explode/implode method for search/replace. 
And, unfortunately, it does it for each entry in the ANSI replacement
table.  Not very efficient, to be sure.

I'm looking at parse_string(), trying to grok it.  I don't know how soon
I'll mess with it, since the current thing actually works, but parsing
and grammars has long been an area that I've wanted to brush up, so this
might be as good a time as any.

If I do, y'all will definitely be hearing from me. ;)

-Kurt

Petter Nyström wrote:
> That's an excellent implementation of search and replace functionaly,
> I agree. But as I understood the scenario, Kurt here had a bunch of
> different codes to replace with actual ansi escapes. Rather than doing
> a search and replace for each of these codes, it surely must be faster
> to implement a parser that finds and replaces all codes in one pass.
>
> Regards,
>
> Jimorie
>
> On 7/8/07, Shentino <shentino at gmail.com> wrote:
>> Fastest way I know of to do a "replace"
>>
>> temp = oldstuff + explode(input, oldstuff) + oldstuff
>> output = implode(temp, newstuff)
>>
>> It's Noah's "Crazy uncle bear" approach, but it works.  I use it all
>> the time myself to escape (and unescape) raw strings so that they can
>> be LPC neutral (without funny escapes doing stuff).  This is how I can
>> output and input strings without worrying about special characters.
>> ___________________________________________
>> https://mail.dworkin.nl/mailman/listinfo/dgd
>>
> ___________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd




More information about the DGD mailing list