Specific parser with Ant

Discussion in 'Java' started by ownowl, Jan 3, 2008.

  1. ownowl

    ownowl Guest

    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
    ownowl, Jan 3, 2008
    #1
    1. Advertising

  2. ownowl

    Arne Vajhøj Guest

    ownowl wrote:
    > 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
    Arne Vajhøj, Jan 3, 2008
    #2
    1. Advertising

  3. ownowl

    Roedy Green Guest

    On Thu, 03 Jan 2008 15:25:29 +0100, ownowl <>
    wrote, quoted or indirectly quoted someone who said :

    >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.
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Jan 4, 2008
    #3
  4. ownowl

    Roedy Green Guest

    On Fri, 04 Jan 2008 02:33:44 GMT, Roedy Green
    <> wrote, quoted or indirectly quoted
    someone who said :

    >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.
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Jan 4, 2008
    #4
  5. ownowl

    ownowl Guest

    Roedy Green a écrit :
    > On Thu, 03 Jan 2008 15:25:29 +0100, ownowl <>
    > wrote, quoted or indirectly quoted someone who said :
    >
    >> 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.


    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
    ownowl, Jan 4, 2008
    #5
  6. On 03.01.2008 15:25, ownowl wrote:
    > 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
    Robert Klemme, Jan 4, 2008
    #6
  7. ownowl

    ownowl Guest

    Robert Klemme a écrit :
    > On 03.01.2008 15:25, ownowl wrote:
    >> 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
    >


    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
    ownowl, Jan 4, 2008
    #7
  8. On 04.01.2008 14:38, ownowl wrote:
    > Robert Klemme a écrit :
    >> On 03.01.2008 15:25, ownowl wrote:
    >>> 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.

    >
    > 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
    Robert Klemme, Jan 4, 2008
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Bedford
    Replies:
    6
    Views:
    2,222
  2. Mladen Adamovic
    Replies:
    0
    Views:
    720
    Mladen Adamovic
    Jan 14, 2005
  3. john martin
    Replies:
    2
    Views:
    2,212
    john martin
    Apr 7, 2005
  4. Replies:
    1
    Views:
    498
    Larry
    Mar 7, 2006
  5. Replies:
    6
    Views:
    868
Loading...

Share This Page