--- a/tools/JavaParser.st Wed Apr 03 22:09:09 2013 +0100
+++ b/tools/JavaParser.st Thu Apr 04 00:53:00 2013 +0100
@@ -29,6 +29,15 @@
"
! !
+!JavaParser class methodsFor:'accessing'!
+
+namesToIgnore
+
+ ^super namesToIgnore ,
+ #(builder)
+
+ "Created: / 03-04-2013 / 23:51:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
!JavaParser methodsFor:'accessing'!
@@ -40,6 +49,72 @@
builder := aJavaParseNodeBuilder.
! !
+!JavaParser methodsFor:'grammar'!
+
+compilationUnit
+ "
+ ^
+ (annotations optional, packageDeclaration) optional ,
+ importDeclaration star ,
+ typeDeclaration star ,
+ (self tokenParserFor:#EOF) end
+ "
+
+ ^super compilationUnit ==> [:nodes |
+ builder newSourceFile_package: (nodes at:1) second imports: (nodes at:2) types: (nodes at:3)
+ ]
+
+ "Created: / 03-04-2013 / 23:18:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+packageDeclaration
+ "
+ ^ (self packageKW) , qualifiedName , (self tokenFor:';')
+ "
+ ^super packageDeclaration ==> [:nodes |
+ builder newPackageDeclaration: (nodes at:2)
+ ]
+
+ "Created: / 03-04-2013 / 23:48:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+typeDeclaration
+
+ ^ ((self tokenFor: ';') ==> nil) / classOrInterfaceDeclaration
+
+ "Created: / 03-04-2013 / 23:58:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaParser methodsFor:'grammar-classes'!
+
+normalClassDeclaration
+ "
+ ^ classModifiers , (self classKW) , self typeNameIdentifier ,
+ typeParameters optional,
+ jsuper optional,
+ interfaces optional ,
+ classBody
+ "
+ ^ super normalClassDeclaration ==> [:nodes|
+ builder newClassDeclaration_modifiers: (nodes at:1)
+ name: (nodes at:3)
+ typeParameters: (nodes at:4)
+ superclass: (nodes at:5)
+ interfaces: (nodes at:6)
+ members: (nodes at:7)
+ ]
+
+ "Created: / 04-04-2013 / 00:04:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!JavaParser methodsFor:'initialization'!
+
+initialize
+ super initialize.
+ builder := JavaParseNodeBuilder new.
+
+ "Created: / 03-04-2013 / 23:52:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
!JavaParser class methodsFor:'documentation'!