Specific parser with Ant

O

ownowl

Hello

I use eclipse and ant for build an application (EAR). So I'd like to
generate a readme file constituted by comments of several sources code.

Ideally I'd like to put two spéchfic flags in source file and keep only
the text between those flags. I looked around FilterChain and
FilterReader ant tasks, but I can not find a way who work well.

Some idea ?
thanks

Olivier
 
A

Arne Vajhøj

ownowl said:
I use eclipse and ant for build an application (EAR). So I'd like to
generate a readme file constituted by comments of several sources code.

Ideally I'd like to put two spéchfic flags in source file and keep only
the text between those flags. I looked around FilterChain and
FilterReader ant tasks, but I can not find a way who work well.

You can write your own task. It is surprisingly easy.

Arne
 
R

Roedy Green

Ideally I'd like to put two spéchfic flags in source file and keep only
the text between those flags. I looked around FilterChain and
FilterReader ant tasks, but I can not find a way who work well.

Some idea ?

You can always write some little Java program that takes command line
parms to do what you want.

Just read the source into RAM. See
http://mindprod.com/jgloss/products.html#HUNKIO

Use indexOf to find your two flags, and substring to suck up the
juice.
 
R

Roedy Green

You can always write some little Java program that takes command line
parms to do what you want.

you can hook it up as a stand alone utility. See
http://mindprod.com/jgloss/ant.html for some examples, or you can hook
it in via the Java API to integrate it even better.

All you need is a week to read all the JavaDoc for how to do it.
 
O

ownowl

Roedy Green a écrit :
You can always write some little Java program that takes command line
parms to do what you want.

Just read the source into RAM. See
http://mindprod.com/jgloss/products.html#HUNKIO

Use indexOf to find your two flags, and substring to suck up the
juice.

thank to you and Arne for your answer

I knew the way of customized java ant task (I done it in the past), but
for this case, for the moment, I prefer use native ant task. So I
finally use a workaround with filterchain and headfilter.

Olivier
 
R

Robert Klemme

I use eclipse and ant for build an application (EAR). So I'd like to
generate a readme file constituted by comments of several sources code.

Ideally I'd like to put two spéchfic flags in source file and keep only
the text between those flags. I looked around FilterChain and
FilterReader ant tasks, but I can not find a way who work well.

You could use a combination of "find" and "sed" to accomplish this.
Maybe you do not even need "find" from an "ant" script.

Kind regards

robert
 
O

ownowl

Robert Klemme a écrit :
You could use a combination of "find" and "sed" to accomplish this.
Maybe you do not even need "find" from an "ant" script.

Kind regards

robert

thanks Robert

I could use those commands, but they are unix commands (isn't it ?), and
I must be windows compliant. And primarily, this readme generator is a
part of several others ant tasks

Olivier
 
R

Robert Klemme

Robert Klemme a écrit :

thanks Robert

I could use those commands, but they are unix commands (isn't it ?), and
I must be windows compliant. And primarily, this readme generator is a
part of several others ant tasks

Well, there's cygwin and there's "Windows Services for Unix". :) But
maybe you find a sed implementation in Java. Of course, writing this in
Java should not be too difficult either.

Kind regards

robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top