User: rinkrank
Date: 02/02/17 17:17:10
Modified: javacc Java1.2-b.jjt
Log:
Added basic functionality for the remove-the-JavadocVisitor refactoring
Revision Changes Path
1.5 +56 -9 xjavadoc/javacc/Java1.2-b.jjt
Index: Java1.2-b.jjt
===================================================================
RCS file: /cvsroot/xdoclet/xjavadoc/javacc/Java1.2-b.jjt,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- Java1.2-b.jjt 17 Feb 2002 21:12:09 -0000 1.4
+++ Java1.2-b.jjt 18 Feb 2002 01:17:10 -0000 1.5
@@ -53,10 +53,19 @@
package xjavadoc.ast;
+// TODO move SourceClass to xjavadoc package,
+// making it package private
+import xjavadoc.parser.SourceClass;
+
public class JavaParser
{
-}
+ // TODO: we need to modify SourceClass' constructor
+ private SourceClass _sourceClass; // = new SourceClass();
+ public SourceClass getSourceClass() {
+ return _sourceClass;
+ }
+}
PARSER_END(JavaParser)
@@ -340,15 +349,41 @@
}
void PackageDeclaration() :
-{}
{
- "package" Name() ";"
+ String packageName;
+}
+{
+ "package" packageName=Name() ";"
+ {
+ /*
+ TODO:
+ _sourceClass.setPackageName( packageName );
+ */
+ System.out.println("Package name:" + packageName);
+ }
}
void ImportDeclaration() :
-{}
{
- "import" Name() [ "." "*" ] ";"
+ String importedElement;
+ boolean isPackage = false;
+}
+{
+ "import"
+ importedElement=Name()
+ [ "." "*" {
+ isPackage = true;
+ } ]
+ ";"
+ {
+ if( isPackage ) {
+ // _sourceClass.addImportedPackage(importedElement);
+ System.out.println( "Imported package:" + importedElement );
+ } else {
+ // _sourceClass.addImportedClass(importedElement);
+ System.out.println( "Imported class:" + importedElement );
+ }
+ }
}
void TypeDeclaration() :
@@ -592,16 +627,28 @@
Type()
}
-void Name() :
+String Name() :
/*
* A lookahead of 2 is required below since "Name" can be followed
* by a ".*" when used in the context of an "ImportDeclaration".
*/
-{}
{
- <IDENTIFIER>
- ( LOOKAHEAD(2) "." <IDENTIFIER>
+ StringBuffer sb = new StringBuffer();
+ Token t;
+}
+{
+ t=<IDENTIFIER>
+ {
+ sb.append(t.image);
+ }
+ ( LOOKAHEAD(2) "." t=<IDENTIFIER>
+ {
+ sb.append(".").append(t.image);
+ }
)*
+ {
+ return sb.toString();
+ }
}
void NameList() :
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel