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

 ##########
 File path: 
daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/ChoiceCombinator.scala
 ##########
 @@ -113,17 +122,17 @@ case class ChoiceCombinator(ch: ChoiceTermBase, 
alternatives: Seq[Gram])
       //Since there is not a choiceBranchKeyRanges attribute, this can only 
currently be populated by repType
       val dispatchBranchKeyRangeTuples: Seq[(RangeBound[BigInt], 
RangeBound[BigInt], Parser, Boolean)] = alternatives.flatMap { alt =>
         val keyTerm = alt.context.asInstanceOf[Term]
-        val branchKeyRanges:Set[(RangeBound[BigInt],RangeBound[BigInt])] = 
ch.defaultableChoiceBranchKeyKind match {
+        val branchKeyRanges:Seq[(RangeBound[BigInt],RangeBound[BigInt])] = 
ch.defaultableChoiceBranchKeyKind match {
           case ChoiceKeyKindType.ByType => {
             val keyTerm_ = keyTerm.asInstanceOf[ElementBase]
-            keyTerm_.simpleType.optRepValueSet.get.valueRanges.map(x=>{
+            keyTerm_.simpleType.optRepValueSet.get.valueRanges.toSeq.map(x=>{
               val x_ = x.asInstanceOf[(RangeBound[BigInt],RangeBound[BigInt])]
               (x_._1,x_._2)
             })
           }
-          case ChoiceKeyKindType.Explicit    => Set()
-          case ChoiceKeyKindType.Implicit    => Set()
-          case ChoiceKeyKindType.Speculative => Set()
+          case ChoiceKeyKindType.Explicit | ChoiceKeyKindType.Implicit    => 
+            
IntRangeCooker.convertConstant(keyTerm.findPropertyOption("choiceBranchKeyRanges").toOption.getOrElse(""),
 context, false)
+          case ChoiceKeyKindType.Speculative => Assert.invariantFailed("Cannot 
have choiceKeyKind==speculative with direct dispatch")
 
 Review comment:
   There's some error messages not adding in this commit that reference 
"dfdl:choiceBranchKeyRanges". But that's added in this commit? Are those error 
messages referencing the wrong thing? Looks likes some primilary 
choiceBranchKeyRange stuff made it into the enum change? Can you fix the error 
messages to have the right dfdlx namespace?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to