mbeckerle commented on a change in pull request #262: Unordered sequences
URL: https://github.com/apache/incubator-daffodil/pull/262#discussion_r320358571
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/SeparatedSequenceParsers.scala
##########
@@ -123,3 +123,13 @@ final class OrderedSeparatedSequenceParser(
override lazy val childProcessors = (sep +:
childrenArg.asInstanceOf[Seq[Parser]]).toVector
}
+
+final class UnorderedSeparatedSequenceParser(
+ rd: SequenceRuntimeData,
+ spos: SeparatorPosition,
+ sep: Parser,
+ choiceParser: ChoiceParser)
+ extends UnorderedSequenceParserBase(rd, choiceParser) {
+
+ override lazy val childProcessors = Vector(choiceParser)
Review comment:
Right here, above is where you want to concatenate the sep parser with the
choice parser. This childProcessors member is just there to satisfy a need to
know all sub parsers (regardless of their role) have been properly initialized.
All the rest of the logic needs to distinguish the sep parser from the
choiceParser so as to handle when they appear together and separately (e.g.,
separatorPositon="postfix" case).
Rather than melding the sep into the choiceParser, and then using your
UnorderedSequenceParserBase, you should not meld it, and reuse
OrderedSequenceParser, providing it the sep parser, and a single child parser
which is the choiceParser. Then you postprocess after that completes to reorg
the infoset which has artifacts of being assembled in unordered manner that you
need to fixup to have it logically be ordered.
----------------------------------------------------------------
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