stevedlawrence commented on a change in pull request #55: Fixes the issue of
separated empty optional elements, (ie. 1:2::4:5).
URL: https://github.com/apache/incubator-daffodil/pull/55#discussion_r176134487
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/ElementKindParsers.scala
##########
@@ -119,18 +119,30 @@ class DynamicEscapeSchemeParser(escapeScheme:
EscapeSchemeParseEv,
}
}
-class SequenceCombinatorParser(rd: TermRuntimeData, bodyParser: Parser)
+class SequenceCombinatorParser(rd: TermRuntimeData, childParsers:
Array[Parser])
extends CombinatorParser(rd) {
override def nom = "Sequence"
override lazy val runtimeDependencies = Nil
- override lazy val childProcessors = Seq(bodyParser)
+ override lazy val childProcessors = childParsers.toSeq
+
+ val numChildParsers = childParsers.size
def parse(start: PState): Unit = {
+ var i: Int = 0
+
start.mpstate.groupIndexStack.push(1L) // one-based indexing
- bodyParser.parse1(start)
+ while (i < numChildParsers) {
+ val parser = childParsers(i)
+ parser.parse1(start)
+ if (start.processorStatus ne Success) {
+ start.mpstate.groupIndexStack.pop()
+ return
Review comment:
return's should be avoided. Maybe remove this ``if`` block and instead
change the loop to ``while (i > numChildren && start.processorStatus eq
Success)``? This has the benefit that it will always execute
``groupIndexStack.pop()`` without duplicating code. Though, I'm not sure if
still calling ``moveOverOneGroupIndexOnly`` would break anything, but that
could be wrapped in a ``processorStatus eq Success`` check if it matters.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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