Jason Pettiss wrote:
Actually, after reading through the parser grammar it's pretty clear this is haunting the authors. They're trying to describe an escape sequence in the grammar itself which causes havoc for the poor parser. Escape sequences should be handled by the scanner. Really when \$ appears in the stream it should be emitted as $ in literal output, with no possibility to be tokenized. Then the grammer doesn't care and is smaller, the parser is faster, and you have an outlet for backwards-compatible growth if in the future you need new language constructs. (Imagine if #hello is in my template. And in the future hello becomes a directive. It breaks me. But if I do \#hello now, then I'm always covered.)

Your point is a good one-- does the speed really matter? In most cases no, it really doesn't. In my case it actually might, I don't know... there are a TON of dollar signs over megabytes of content. I'm just imagining an interrupted stream and a hashmap lookup for each and every one... there's no notion of constant or final template variables is there?

Hmm.  Anyway, thanks for the thoughts.
[snip]

I can see that you understood the issue with escaping and the grammar
(not my dog-food :), the issue that parsing any schmoo should produce
the same schmoo prohibits gobbling the backslash in a \$foo sequence.

OTOH, your idea of a "notion of constant or final template variables"
is a good one. The short answer is no :(

So this could be a feature request. Could it be done during parse time
creating the text nodes?

A workaround is to walk yourself the AST from an already parsed template
and work in the appropriate text nodes into the exising nodes before or
after!. Is this feasible? One could fit such a thing in by wrapping
an existing resource loader. (Side note: the post-processing of the
AST is an idea I have been thinking about for the whitespace gobbling
handling issue... more on this issue is in the wiki)

Cheers,
Christoph

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to