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

 ##########
 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:
   If your afriad nor implies exclusive alterantives, maybe something like "At 
least one of dfdl:choiceBranchKey or dfdlx:choiceBranchKeyRanges must be 
defined."

----------------------------------------------------------------
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