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

 ##########
 File path: 
daffodil-lib/src/main/scala/org/apache/daffodil/cookers/Cookers.scala
 ##########
 @@ -84,3 +89,28 @@ object ChoiceBranchKeyCooker extends 
ListOfStringLiteralNonEmptyNoCharClassEntit
 object RepValueCooker extends 
ListOfStringLiteralNonEmptyNoCharClassEntitiesNoByteEntities()
 
 object UpperCaseTokenCooker extends UpperCaseToken
+
+object IntRangeCooker extends Converter[String, Seq[Range[BigInt]]] {
+  protected def convert(input: String, context: ThrowsSDE, forUnparse: 
Boolean): Seq[Range[BigInt]] = {
+    def run(xs: Seq[String]): Seq[(RangeBound[BigInt], RangeBound[BigInt])] = {
+      xs match {
+        case Seq() => Seq()
+        case a +: b +: rest => {
+          val a2 = BigInt(a)
+          val b2 = BigInt(b)
+          if (a2.compare(b2) > 0) {
+            context.SDE("min value must not be greater than max value")
 
 Review comment:
   Would also be good to mention the property name, but I guess our cookers 
don't have acess to that information? Might be a good future enhancement to the 
cookers.

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