Title: [1501] trunk/qdox/src/grammar/parser.y: Add jls specs in comments, reorder
Revision
1501
Author
rfscholte
Date
2012-04-21 13:31:01 -0500 (Sat, 21 Apr 2012)

Log Message

Add jls specs in comments, reorder

Modified Paths


Diff

Modified: trunk/qdox/src/grammar/parser.y (1500 => 1501)


--- trunk/qdox/src/grammar/parser.y	2012-04-21 17:56:36 UTC (rev 1500)
+++ trunk/qdox/src/grammar/parser.y	2012-04-21 18:31:01 UTC (rev 1501)
@@ -269,37 +269,7 @@
                    { 
                      $$ = $1.getName() + '.' + $3;
                    };
-               
-// 4.4 Type Variables
-TypeParameter: IDENTIFIER 
-               { 
-                 typeVariable = new TypeVariableDef($1);
-                 typeVariable.setBounds(new LinkedList<TypeDef>());
-               }
-               TypeBound_opt
-               {
-                 typeParams.add(typeVariable);
-                 typeVariable = null;
-               };
 
-TypeBound_opt:
-             | TypeBound;
-
-TypeBound: EXTENDS ClassOrInterfaceType
-		   {
-		     typeVariable.setBounds(new LinkedList<TypeDef>());
-		     typeVariable.getBounds().add($2);
-		   }
-		   AdditionalBoundList_opt;
-		   
-AdditionalBoundList_opt:
-                       | AdditionalBoundList_opt AdditionalBound;		   
-
-AdditionalBound: AMPERSAND ClassOrInterfaceType
-                 { 
-                   typeVariable.getBounds().add($2); 
-                 };
-
 TypeArguments_opt:
                  | TypeArguments;
 
@@ -352,7 +322,66 @@
                        $$ = $1 + '.' + $3;
                      }
                    ;
+//---------------------------------------------------------
 
+// NonWildcardTypeArguments:
+//     < TypeList >
+NonWildcardTypeArguments: LESSTHAN TypeList GREATERTHAN;
+
+// TypeList:  
+//     ReferenceType { , ReferenceType }
+TypeList: ReferenceType
+        | TypeList COMMA ReferenceType
+        ;
+
+TypeParameters_opt: 
+                  | TypeParameters
+                  ;
+
+// TypeParameters:
+//     < TypeParameter { , TypeParameter } >
+TypeParameters: LESSTHAN 
+                { 
+                  typeParams = new LinkedList<TypeVariableDef>(); 
+                } 
+                TypeParameterList GREATERTHAN
+              ;
+TypeParameterList: TypeParameter 
+                 | TypeParameterList COMMA TypeParameter
+                 ;
+
+// TypeParameter:
+//     Identifier [extends Bound]
+TypeParameter: IDENTIFIER 
+               { 
+                 typeVariable = new TypeVariableDef($1);
+                 typeVariable.setBounds(new LinkedList<TypeDef>());
+               }
+               extendsBound_opt
+               {
+                 typeParams.add(typeVariable);
+                 typeVariable = null;
+               };
+extendsBound_opt:
+                | EXTENDS
+                  {
+                    typeVariable.setBounds(new LinkedList<TypeDef>());
+                  } 
+                  Bound
+                ;
+             
+// Bound:
+//     ReferenceType { & ReferenceType }
+Bound: ReferenceType
+       {
+         typeVariable.getBounds().add($1);
+       }
+     | Bound AMPERSAND ReferenceType
+       {
+         typeVariable.getBounds().add($3);
+       }
+     ;  
+//---------------------------------------------------------
 Modifiers_opt:
              | Modifiers_opt Modifier;
 
@@ -415,30 +444,7 @@
             modifiers.add("strictfp");
           }
         ;
-
-//---------------------------------------------------------
-
-// NonWildcardTypeArguments:
-//     < TypeList >
-NonWildcardTypeArguments: LESSTHAN TypeList GREATERTHAN;
-
-// TypeList:  
-//     ReferenceType { , ReferenceType }
-TypeList: ReferenceType
-        | TypeList COMMA ReferenceType;
-
-TypeParameters_opt: 
-                  | TypeParameters;
-
-TypeParameters: LESSTHAN 
-                { 
-                  typeParams = new LinkedList<TypeVariableDef>(); 
-                } 
-                TypeParameterList GREATERTHAN;
-
-TypeParameterList: TypeParameter 
-                 | TypeParameterList COMMA TypeParameter;
-                 
+        
 // 8.1.5 Superinterfaces
 Interfaces_opt:
               | Interfaces;
@@ -720,33 +726,38 @@
 Annotations_opt: 
                | Annotations_opt Annotation;
 
-Annotation /* = NormalAnnotation*/: AT QualifiedIdentifier /* =TypeName */ 
-                                    {
-                                      AnnoDef annotation = new AnnoDef( new TypeDef($2) );
-                                      annotation.setLineNumber(lexer.getLine());
-                                      annotationStack.addFirst(annotation);
-                                    }
-                                    annotationParensOpt
-                                    {
-                                      AnnoDef annotation = annotationStack.removeFirst();
-                                      if(annotationStack.isEmpty()) 
-                                      {
-                                        builder.addAnnotation(annotation);
-                                      }
-                                      $$ = annotation;
-                                    };
-    
-annotationParensOpt:
-	               | PARENOPEN ElementValue PARENCLOSE 
-	                 { 
-	                   annotationStack.getFirst().getArgs().put("value", $2);
-                     }
-	               | PARENOPEN ElementValuePairs_opt PARENCLOSE;
-  
-ElementValuePairs_opt:
-                     | ElementValuePairs;   
+// Annotation:
+//     @ QualifiedIdentifier [ ( [AnnotationElement] ) ]
+Annotation: AT QualifiedIdentifier 
+	        {
+	          AnnoDef annotation = new AnnoDef( new TypeDef($2) );
+	          annotation.setLineNumber(lexer.getLine());
+	          annotationStack.addFirst(annotation);
+	        }
+	        annotationParensOpt
+	        {
+	          AnnoDef annotation = annotationStack.removeFirst();
+	          if(annotationStack.isEmpty()) 
+	          {
+	            builder.addAnnotation(annotation);
+	          }
+	          $$ = annotation;
+	        };
+ annotationParensOpt:
+	               | PARENOPEN AnnotationElement_opt PARENCLOSE 
+	               ;
 
-    
+// AnnotationElement:
+//     ElementValuePairs
+//     ElementValue
+AnnotationElement_opt: 
+                     | ElementValuePairs
+                     | ElementValue
+                       { 
+	                     annotationStack.getFirst().getArgs().put("value", $1);
+                       }
+                     ;
+                   
 ElementValuePairs: ElementValuePair 
                  | ElementValuePairs COMMA ElementValuePair;
     

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to