[DGD] To token or not to token...

Felix A. Croes felix at dworkin.nl
Mon Apr 19 10:34:45 CEST 2010


<jimorie at gmail.com> wrote:

>[...]
> Consider the following input string as an example:
>
>
> <html attribute="<%write("foo");%>">

You're using " to delimit both HTML attribute strings and LPC strings
without escaping the latter.


>[...]
> My understanding is that I can't use a token pattern to match string
> constants here, and then things turn tricky for me...
>
> Should I try to parse this with just the double quote as a token, and
> work my way from there with the resulting parse tree? Or should I
> maybe still use a full string token, but use a second parse pass to
> parse the matched strings depending on where I find them?

You will need two passes and two different grammars.

Regards,
Felix Croes



More information about the DGD mailing list