You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Matt Benson <gu...@yahoo.com> on 2005/02/18 22:29:26 UTC

macro/for fun

Anyone from ant-contrib want to add a caveat to the
documentation of the for task?  Being based on
macrodefs, for is the only place I know of where this
comes into play:  since the @ character is escaped
with another (@@) in macrodefs/for, nested for loops
must double-escape the @ character (@@@@).  This
applies to for loops appearing in macros as well. 
Looks like the rule is an additional two '@'s per
nesting level.  So no nesting = @@, one level deep =
@@@@, and two levels deep = @@@@@@ .

-Matt


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: macro/for fun

Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 18 Feb 2005, Matt Benson <gu...@yahoo.com> wrote:

> Anyone from ant-contrib want to add a caveat to the
> documentation of the for task?

I'd like to volunteer Peter for this ;-)

> Being based on macrodefs, for is the only place I know of where this
> comes into play: since the @ character is escaped with another (@@)
> in macrodefs/for, nested for loops must double-escape the @
> character (@@@@).

Cool.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: macro/for fun

Posted by Peter Reilly <pe...@apache.org>.
Matt Benson wrote:

>Anyone from ant-contrib want to add a caveat to the
>documentation of the for task?  Being based on
>macrodefs, for is the only place I know of where this
>comes into play: 
>
Same applies to macros in macros!

> since the @ character is escaped
>with another (@@) in macrodefs/for, nested for loops
>must double-escape the @ character (@@@@).  This
>applies to for loops appearing in macros as well. 
>Looks like the rule is an additional two '@'s per
>nesting level.  So no nesting = @@, one level deep =
>@@@@, and two levels deep = @@@@@@ .
>  
>
No, It is doubling each level:
    <property name="chars" value="a"/>
    <ac:for param="c1" list="${chars}">
      <sequential>
        <ac:for param="c2" list="${chars}">
          <sequential>
            <ac:for param="c3" list="${chars}">
              <sequential>
                <echo>'@@@@@@@@'</echo>
              </sequential>
            </ac:for>
          </sequential>
        </ac:for>
      </sequential>
    </ac:for>

outputs '@'

Actually on testing, it seems that there is a bug with the escaping of
nested @{x}, will investigate further.

Peter

>-Matt
>
>
>		
>__________________________________ 
>Do you Yahoo!? 
>Yahoo! Mail - now with 250MB free storage. Learn more.
>http://info.mail.yahoo.com/mail_250
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org