> From: Jack J. Woehr [mailto:[EMAIL PROTECTED]
> 
> Dominique Devienne wrote:
> 
> > I believe that ${${a}.${b}} is parsed as:
> >
> > getProperty("${a") + "." + getProperty("b") + "}", thus the result. --DD
> 
> Well, it sure looks like it is :-)
> 
> But is that result reasonable? It looks more to me like an artifact of a
> coding strategy being elevated to a principle.

First, don't shoot the messenger ;-)

Second, what's one to do? Ant by contract does not support nested
properties, so what's Ant to do when it sees on opening ${? It looks for the
closing curly brace, which is found after ${a, which is thus interpreted as
the property name to reference?

I duplicated the Ant logic using JDK 1.4 regex, and have the same logic
using the "\\$\\{([^\\}]+)\\}" regex (in Java code, thus the escapes). I
even have a test case that shows what you just discovered:

  protected void setUp() {
    _ve = new VariableEvaluator();
    _ve.putVariable("foo", "bar");
    _ve.putVariable("ding", "dong");
    _ve.putVariable("var${weird", "indeed");
  }

  public void test_evalString() {
    assertEval(_ve, "${var${varname}}", "${var${varname}}", true);
    assertEval(_ve, "${var${weird}}", "indeed}", false);
  }

--DD

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

Reply via email to