parsing a java src file

Discussion in 'Perl Misc' started by ron.mexico.chicago@gmail.com, Jan 28, 2006.

  1. Guest

    how do i parse a java src file, specifically for this:

    public class test { public static final test alpha = new test("foo",
    "bar"); public static final test beta = new test("baz", "boo"); ...
    [download]


    so that i'm finding all local variables that match the classname, and
    get the parameters that are passed to the constructor.
    this is easy enough if it's all on the same line and the order is
    consistent, but there might be carriage returns and the static/final
    words might be interchanged.
    In the above example, i'm strictly looking for:
    alpha = {foo, bar}
    beta = {baz, boo}

    thoughts?
    thanks
     
    , Jan 28, 2006
    #1
    1. Advertising

  2. wrote:
    > how do i parse a java src file, specifically for this:


    I would suppose you write a Java parser, just like for any other programming
    language.

    [...]
    > this is easy enough if it's all on the same line and the order is
    > consistent, but there might be carriage returns and the static/final
    > words might be interchanged.


    Those are items that a parser will have to take into account. Where is the
    problem?

    jue
     
    Jürgen Exner, Jan 28, 2006
    #2
    1. Advertising

  3. Guest

    there's no specific problem, i'm just wondering if this has been done
    before, and if so , is there a spot i could take a look at it
     
    , Jan 28, 2006
    #3
    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. Steve Richter

    <txt src= ...> equivalent of <img src= ...>

    Steve Richter, Feb 8, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    2,177
    Laurent Bugnion
    Feb 9, 2006
  2. Greg Johnson
    Replies:
    4
    Views:
    3,140
  3. Replies:
    1
    Views:
    1,674
    Alex Hunsley
    Mar 23, 2007
  4. pheadxdll
    Replies:
    16
    Views:
    3,885
    Neredbojias
    Jun 6, 2007
  5. Soren Vejrum
    Replies:
    4
    Views:
    762
    Lasse Reichstein Nielsen
    Jul 5, 2003
Loading...

Share This Page