You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2019/08/27 16:27:55 UTC

[GitHub] [incubator-daffodil] stevedlawrence commented on a change in pull request #262: Unordered sequences

stevedlawrence commented on a change in pull request #262: Unordered sequences
URL: https://github.com/apache/incubator-daffodil/pull/262#discussion_r318146394
 
 

 ##########
 File path: daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/SequenceCombinator.scala
 ##########
 @@ -76,3 +78,63 @@ class OrderedSequence(sq: SequenceTermBase, sequenceChildrenArg: Seq[SequenceChi
     }
   }
 }
+
+class UnorderedSequence(sq: SequenceTermBase, sequenceChildrenArg: Seq[SequenceChild], alternatives: Seq[Gram])
+  extends SequenceCombinator(sq, sequenceChildrenArg) {
+
+  private lazy val sepGram = sq.sequenceSeparator
+  private lazy val sepParser = sepGram.parser
+  private lazy val sepUnparser = sepGram.unparser
+
+  private lazy val sequenceChildren = sequenceChildrenArg.toVector
+
+
+  private lazy val parsers = {
+    val res = alternatives.map { alt =>
+      val p = alt.parser
+      val res =
+        if (p.isEmpty)
+          new EmptyChoiceBranchParser(alt.context.runtimeData)
 
 Review comment:
   Does this make sense for an unordered sequence? Is it even possible? I believe this is used for choices for something like
   ``` xml
   <xs:choice>
     ...
     </xs:sequence> <!-- empty choice branch if other branches fail -->
   </xs:choice>
   ```
   But I don't think it even makes sense to have an empty sequence in an unordered sequence.
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services