# HG changeset patch # User Jan Vrany # Date 1378112232 -3600 # Node ID e6ebebcddbec5be40cb955e69704cd49c45dda6b # Parent 44a062d9aae8fd22ba1a283411525e3f0a90e5d1 Minor refactoring of Parser (formal parameters) diff -r 44a062d9aae8 -r e6ebebcddbec tools/JavaParser.st --- a/tools/JavaParser.st Mon Sep 02 01:02:26 2013 +0100 +++ b/tools/JavaParser.st Mon Sep 02 09:57:12 2013 +0100 @@ -110,6 +110,16 @@ "Created: / 24-08-2013 / 01:40:33 / Jan Vrany " ! +formalParameters + +"/ ^ (self tokenFor: '(') , +"/ formalParameterDecls optional , +"/ (self tokenFor: ')') + ^ super formalParameters ==> [:nodes | nodes second ] + + "Created: / 31-08-2013 / 23:09:05 / Jan Vrany " +! + normalClassDeclaration " ^ classModifiers , (self classKW) , self typeNameIdentifier , @@ -128,6 +138,32 @@ ] "Created: / 04-04-2013 / 00:04:00 / Jan Vrany " +! + +normalParameterDecls +"/ ^ normalParameterDecl , ((self tokenFor: ',') , normalParameterDecl) star + ^ super normalParameterDecls ==> [:nodes| +"/ | params | +"/ +"/ params := OrderedCollection new. +"/ params add: nodes first. +"/ nodes second do:[:pair| +"/ params add: pair second +"/ ]. +"/ params. + nodes. + ]. + + "Created: / 01-09-2013 / 09:30:49 / Jan Vrany " +! + +normalParameterDeclsAndEllipsisParameterDecl +"/ ^ normalParameterDecls , (self tokenFor: ',') , ellipsisParameterDecl + ^ super normalParameterDeclsAndEllipsisParameterDecl ==> [:nodes | + nodes first copyWith: nodes third. + ] + + "Created: / 01-09-2013 / 09:29:11 / Jan Vrany " ! ! !JavaParser methodsFor:'grammar-classes-method'! diff -r 44a062d9aae8 -r e6ebebcddbec tools/JavaParserII.st --- a/tools/JavaParserII.st Mon Sep 02 01:02:26 2013 +0100 +++ b/tools/JavaParserII.st Mon Sep 02 09:57:12 2013 +0100 @@ -41,7 +41,8 @@ arrayCreator createdName arrayInitializer constructorDeclaration constructorModifiers methodNotConstructorDeclaration wildcard emptySquaredParenthesis methodModifierNotAnnotation - classModifierNotAnnotation classInitializer methodBody' + classModifierNotAnnotation classInitializer methodBody + normalParameterDeclsAndEllipsisParameterDecl normalParameterDecls' classVariableNames:'' poolDictionaries:'' category:'Languages-Java-Parser' @@ -464,15 +465,20 @@ ! formalParameterDecls - - ^ ellipsisParameterDecl + + ^ ellipsisParameterDecl + / normalParameterDeclsAndEllipsisParameterDecl + / normalParameterDecls optional + - / ((normalParameterDecl , - (self tokenFor: ',')) plus , - ellipsisParameterDecl) - - / (normalParameterDecl , - ((self tokenFor: ',') , normalParameterDecl) star) +"/ / ((normalParameterDecl , +"/ (self tokenFor: ',')) plus , +"/ ellipsisParameterDecl) +"/ +"/ / (normalParameterDecl , +"/ ((self tokenFor: ',') , normalParameterDecl) star) + + "Modified: / 01-09-2013 / 03:17:07 / Jan Vrany " ! formalParameters @@ -503,6 +509,18 @@ "Modified: / 15-03-2012 / 09:01:46 / Jan Vrany " ! +normalParameterDecls + ^ normalParameterDecl , ((self tokenFor: ',') , normalParameterDecl) star + + "Created: / 01-09-2013 / 03:18:35 / Jan Vrany " +! + +normalParameterDeclsAndEllipsisParameterDecl + ^ normalParameterDecls , (self tokenFor: ',') , ellipsisParameterDecl + + "Created: / 01-09-2013 / 03:16:55 / Jan Vrany " +! + primitiveType ^ (self booleanKW)