- Revision
- 1123
- Author
- rfscholte
- Date
- 2011-03-17 17:41:05 -0500 (Thu, 17 Mar 2011)
Log Message
The optional comma is now accepted for ElementValueArrayInitializer (ElementValueArrayInitializer: { ElementValuesopt ,opt })
Test addedModified Paths
Diff
Modified: trunk/qdox/src/grammar/parser.y (1122 => 1123)
--- trunk/qdox/src/grammar/parser.y 2011-03-17 22:16:23 UTC (rev 1122) +++ trunk/qdox/src/grammar/parser.y 2011-03-17 22:41:05 UTC (rev 1123) @@ -209,7 +209,11 @@ { annotationStack.getFirst().args.put($1, $3); }; - + +/* Specs say: { ElementValues_opt COMMA_opt } + The optional COMMA causes trouble for the parser + For that reason the adjusted options of ElementValues_opt, which will accept all cases +*/ ElementValueArrayInitializer: { annoValueListStack.add(annoValueList); annoValueList = new LinkedList(); @@ -221,17 +225,12 @@ }; ElementValues_opt: - | ElementValues; + | ElementValues_opt ElementValue + { + annoValueList.add($2); + } + | ElementValues_opt COMMA; -ElementValues: ElementValue - { - annoValueList.add($1); - } - | ElementValues COMMA ElementValue - { - annoValueList.add($3); - }; - ElementValue: _expression_ | Annotation | ElementValueArrayInitializer ; @@ -460,9 +459,9 @@ ClassModifiers_opt: modifiers; -/* Specs say: EnumConstants_opt ,_opt EnumBodyDeclarations_opt +/* Specs say: { EnumConstants_opt ,_opt EnumBodyDeclarations_opt } The optional COMMA causes trouble for the parser - For that reason the options of EnumConstants_opt, which will accept all cases + For that reason the adjusted options of EnumConstants_opt, which will accept all cases */ EnumBody: BRACEOPEN EnumConstants_opt EnumBodyDeclarations_opt BRACECLOSE { builder.endClass();
Modified: trunk/qdox/src/test/com/thoughtworks/qdox/AnnotationExpressionTest.java (1122 => 1123)
--- trunk/qdox/src/test/com/thoughtworks/qdox/AnnotationExpressionTest.java 2011-03-17 22:16:23 UTC (rev 1122) +++ trunk/qdox/src/test/com/thoughtworks/qdox/AnnotationExpressionTest.java 2011-03-17 22:41:05 UTC (rev 1123) @@ -105,8 +105,10 @@ {"(int)((short)1 + (long)3)", new Integer( 4 )}, //test Array-valued single-element annotation - { "{\"Children\", \"Unscrupulous dentists\"}", Arrays.asList(new String[]{"Children", "Unscrupulous dentists"})} + { "{\"Children\", \"Unscrupulous dentists\"}", Arrays.asList(new String[]{"Children", "Unscrupulous dentists"})}, + //test Array-valued annotation ending with a comma + { "{\"deprecated\", }", Arrays.asList(new String[]{"deprecated"})} }); }
To unsubscribe from this list please visit:
