Printing out contents of block comments in line order

30 views
Skip to first unread message

Andras

unread,
Mar 4, 2010, 3:41:37 AM3/4/10
to JavaParser
Hi there

I would like to print out all the comments in a compilation unit in
line order. So, for example, for the following class:

public class TestClass {

/**
* Method comment
*/
public void hello() {
/*
* Inner comment
*/
}

}

I would want to have the following printed:

Method comment
Inner comment

Mooty, Mathew

unread,
Apr 18, 2010, 7:48:05 PM4/18/10
to JavaParser
Because of the way that a visitor pattern works (if you were to use
one) if you print outer nodes first, and their children second, it
should work. Also, the Node class contains a line number accessor
method, which should allow you to sort out which children to print
first.

Best of luck,
Mathew Mooty
--
You received this message because you are subscribed to the Google Groups "JavaParser" group.
To post to this group, send email to javap...@googlegroups.com.
To unsubscribe from this group, send email to javaparser+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaparser?hl=en.

Reply all
Reply to author
Forward
0 new messages