I've just finished my nesting PreparedVariableResolver, along with some test cases. After getting the test cases to work, the Cocoon samples seem to work fine, without any modification!!! Wow! [I guess I'm used to breaking things when I change them. Unit tests seem like a great way to stop me from doing that!]

Anyway, I've committed it over the top of the existing implementation, which is what was discussed on this list.

The change should be transparent as far as existing sitemaps are concerned, even though it is a total rewrite. Only difference should be that you can nest now.

If poss, can you check out the test case - make sure I've got everything. I think I did.

Finally, the dispose method isn't called by the ExcaliburTestCase, so I haven't debugged it. Can someone who knows Avalon stuff check that my code looks alright within dispose()?

- o -

This code does make some interesting things possible, including some nasty, and potentially dangerous, hacks. To explain what it does:

Here's a rough take on the parsing rules, roughly based on the Yacc syntax:

expr: text                       {result = new expr(text) }
expr: { text : expr }        {result = evalModule( text, expr) }
expr: {text}                   {result = evalVariable(text) }
expr: expr expr              {result = expr + expr }

What you can see here is that, anything immediately following an open bracket, must be text - it cannot be an expression. So you cannot do {{2}}. To achieve that, you'd do {sitemap:{2}}, as the {2} is now after the colon, and thus an expression.

We could do with some documentation about this - as there's some interesting consequences that should be written about, and recommendations/bad practice. Any suggestions where?

Hope this is useful (and works)

Regards, Upayavira




Reply via email to