kaz 02/04/21 18:56:53
Modified: src/java/org/apache/maven/java/parser JavaParser.jjt
Log:
Modifications to the Java grammar. Previously, this grammar was failing
to parser about 90 of the source files in the Maven repository. These
changes enable all but one file to be parsed successfully. Specifically
the following changes were made:
- Methods defined in interfaces weren't able to contain JavaDoc
comments. This has been fixed.
- If more than one class or interface is defined in a file, the parser
would barf if it contained JavaDoc. This has been fixed.
- Finally, if a JavaDoc ended in "**/" or began with more than two
"**"'s then the parser would barf. This has been fixed.
The reason the last file is failing to parse is because the file starts
with a JavaDoc and this has not been accounted for in the grammar. I'll
still working on it. Also, the JavaDoc grammar still fails to _not_
parse the '@' in a mailto: (thanks to dion for pointing this out).
Still trying to work on a good solution for this.
Revision Changes Path
1.5 +6 -6
jakarta-turbine-maven/src/java/org/apache/maven/java/parser/JavaParser.jjt
Index: JavaParser.jjt
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/java/parser/JavaParser.jjt,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JavaParser.jjt 16 Apr 2002 18:14:50 -0000 1.4
+++ JavaParser.jjt 22 Apr 2002 01:56:53 -0000 1.5
@@ -57,6 +57,7 @@
public class JavaParser
{
+
/**
* This constructor was added to allow the re-use of parsers.
* The normal constructor takes a single argument which
@@ -373,8 +374,7 @@
{
[ PackageDeclaration() ]
( ImportDeclaration() )*
- [ JavaDocEntry() ]
- ( TypeDeclaration() )*
+ ( [ JavaDocEntry() ] TypeDeclaration() )*
<EOF>
{
return jjtThis;
@@ -483,7 +483,7 @@
{}
{
"interface" <IDENTIFIER> [ "extends" NameList() ]
- "{" ( InterfaceMemberDeclaration() )* "}"
+ "{" ( [ JavaDocEntry() ] InterfaceMemberDeclaration() )* "}"
}
void InterfaceMemberDeclaration() :
@@ -1153,8 +1153,8 @@
<IN_FORMAL_COMMENT>
SKIP:
{
- <JAVADOC_START: "/**" >
-| <JAVADOC_END: "*/" > : DEFAULT
+ <JAVADOC_START: "/**" (<ASTERIX>)* >
+| <JAVADOC_END: (<ASTERIX>)* "*/" > : DEFAULT
}
<IN_FORMAL_COMMENT>
@@ -1168,7 +1168,7 @@
void JavaDocEntry() :
{}
{
- JavaDocText() [ ( JavaDocTag() )+ ]
+ JavaDocText() [ ( JavaDocTag() )+ ]
}
void JavaDocText():