[DGD] Reasonable Tick Counts?
Kurt Nordstrom
kurt at blar.net
Mon Jul 9 19:38:56 CEST 2007
The current 'syntax' is something like @[x], where x is something like fr
for "foreground red" or b for "bold". Might change after I futz with it a
while.
I read in the parser documentation that using the "nomatch" rules were
exceedingly inefficient. Is there any way around that? How inefficient
are they? Enough to make parse_string slower than the explode/implode
method I'm using currently?
-Kurt
> Is there some common syntax that defines all your "escapes"?
>
> If there is a way to unambiguously separate regular 'fragments" from
> special "fragments" I suggest something like the following grammar:
>
> special = /(regexes for your escapable stuff)/
> ...
> normal = nomatch
>
> message: ? build_empty_message
> message: message piece ? concatenate
>
> piece: normal
> piece: special ? convert
>
> And in the LPC object doing the parsing:
>
> string *build_empty_message(string *input)
> {
> return ({ "" });
> }
>
> string *concatenate(string *input)
> {
> return ({ input[0] + input[1] });
> }
>
> string *convert(string *input)
> {
> return ({ frobnicate(input[0]);
> }
>
> For frobnicate, just do whatever translation you want to.
>
> Unfortunately the grammar above will only work if your regular stuff
> and your special stuff can be cleanly broken apart. It won't handle
> fancy nested stuff.
> ___________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd
>
More information about the DGD
mailing list