You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Keith Robertson <ko...@yahoo.com> on 2004/11/04 20:23:22 UTC

Use the replace task to insert line numbers and file names?

Is it possible to use the replace task to scan
sourcecode for tokens and then replace them with the
line number of that token in its respective file?

I've looked at ant's docs and was hoping to see
something like an environment variable for the line
number and perhaps the file name of the current file
being scanned but I didn't find anything.

I was hoping I could do something like this...
<replace dir="${mysrc}" token="__LINE__"
value="${CURRENT_LINE}"/>
<replace dir="${mysrc}" token="__FILE__"
value="${CURRENT_FILE}"/>

Does anyone have any thoughts on how I might do this?

Cheers,
Keith



		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


Re: Use the replace task to insert line numbers and file names?

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 4 Nov 2004, Keith Robertson <ko...@yahoo.com> wrote:

> Is it possible to use the replace task to scan
> sourcecode for tokens and then replace them with the
> line number of that token in its respective file?

No.

> Does anyone have any thoughts on how I might do this?

You could write a filterreader[1] that keeps track of the line number and
does the replace.  And then use a copy task together with that
filterreader.

Stefan

Footnotes: 
[1]  http://ant.apache.org/manual/CoreTypes/filterchain.html


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