[Cheetahtemplate-discuss] Matching #end tags
Brought to you by:
rtyler,
tavis_rudd
From: Bob V. Z. <bva...@ir...> - 2004-12-11 01:06:40
|
Here's a patch that attempts to perform matching of #end tags to the opening tags [if,for,while,def]. The goal of this is that, well, those of you that have ever forgotten a #end if know what I'm talking about. This patch was jointly authored with JJ. I was just going to do an assert(stack_depth == 0) at the end. The ParseErrors are -much- nicer and we're able to more accurately tell the programmer where things blew up since we catch the #end def being used as an #end if and go "wow wow wow, hold on there, cowboy!" Note that in this implementation def and end def are special cased. They don't appear to call the indent routines in the same way the for, while and if do. So we explicitly called addStack and rmStack for them. -Bob |