mbeckerle commented on a change in pull request #240: Add 
dfdlx:choiceBranchKeyRanges
URL: https://github.com/apache/incubator-daffodil/pull/240#discussion_r295547763
 
 

 ##########
 File path: 
daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/ChoiceCombinator.scala
 ##########
 @@ -83,6 +84,15 @@ case class ChoiceCombinator(ch: ChoiceTermBase, 
alternatives: Seq[Gram])
         case ChoiceLengthKind.Explicit => new SpecifiedLengthChoiceParser(cp, 
ch.choiceRuntimeData, choiceLengthInBits.get)
       }
     } else {
+      //Verify that every alternative has some form of branch key
+      alternatives.map{ alt =>
+        val keyTerm = alt.context.asInstanceOf[Term]
+        val hasBranchKey = 
keyTerm.findPropertyOption("choiceBranchKey").isDefined
+        val hasBranchKeyRanges = 
keyTerm.findPropertyOption("choiceBranchKeyRanges").isDefined
+        if(!hasBranchKey && !hasBranchKeyRanges && 
ch.defaultableChoiceBranchKeyKind != ChoiceKeyKindType.ByType){
+          keyTerm.SDE("dfdl:choiceBranchKey and dfdlx:choiceBranchKeyRanges 
are not defined.")
 
 Review comment:
   Should say "Neither dfdl:choiceBranchKey nor dfdlx:choiceBranchKeyRanges is 
defined." since these are alternatives and neither-nor is singular. Of course I 
realize they aren't exclusive alternatives. One can have both, but neither-nor 
is still less ambiguous than "and". 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to