Identifying java file with out Javadoc
I would like to parse .java files which does NOT contain description about the class.
I am trying it to do with perl, but not able to get the approprate regexp to parse the following pattern
/**
* Some text describing about the class
*
*/
For example:
Class 开发者_StackOverflowCommunicationServer {
...
}
The description of class is missing. What regexp can be used in perl to parse this type of pattern?
Here is the what I tried but it does not work
while ( valid file handle) {
my $isLine = $_;
chomp($isLine);
if ($isLine =~ m/^(\/\*\\*)/) {
#if ($isLine =~ /[^\W]/) { # Any non-word character.
print $isLine ".\n";
}
}
Or are you aware of any tool which help me to identify the non document class such as above?
Many thanks for input.
(/\\*\\*.*?\\*/[^;]*?class[^{]*)\\{
This thing can capture one class definition with a javadoc from a file. In case you don't have nested classes with javadoc and don't want to check them, you can use it. If this regex fails then your file does not have a class javadoc.
Make sure that your \s
and .
eat newline.
This may not always work. Did not test it much. Comment and I will answer.
精彩评论