Github user VTGuy commented on a diff in the pull request:
https://github.com/apache/incubator-daffodil/pull/4#discussion_r153522076
--- Diff:
daffodil-runtime1/src/main/scala/edu/illinois/ncsa/daffodil/processors/parsers/RepParsers.scala
---
@@ -207,87 +258,134 @@ class RepUnboundedParser(occursCountKind:
OccursCountKind.Value, rParser: Parser
extends RepParser(-1, rParser, erd, "Unbounded") {
def parseAllRepeats(initialState: PState): Unit = {
+ var startState: PState.Mark = null
+ var priorState: PState.Mark = null
+ var markLeakCausedByException = false
+
Assert.invariant(initialState.processorStatus eq Success)
- val startState = initialState.mark("RepUnboundedParser1")
- val pstate = initialState
- var priorState = initialState.mark("RepUnboundedParser2")
- var returnFlag = false
- while (!returnFlag && (pstate.processorStatus eq Success)) {
-
- // erd.maxOccurs.foreach { maxOccurs =>
- // if ((occursCountKind == OccursCountKind.Implicit) &&
- // (maxOccurs == -1)) {
- // erd.minOccurs.foreach { minOccurs =>
- // if (pstate.mpstate.arrayPos - 1 <= minOccurs) {
- // // Is required element
- // // Need to trigger default value creation
- // // in right situations (like the element is
defaultable)
- // // This is relatively easy for simple types
- // // for complex types, defaulting is trickier as one
- // // must recursively traverse the type, and then
determine one
- // // has not advanced the data at all.
- // }
- // }
- // }
- // }
-
- //
- // Every parse is a new point of uncertainty.
- pstate.pushDiscriminator
- if (pstate.dataProc.isDefined)
pstate.dataProc.get.beforeRepetition(pstate, this)
-
- try {
- rParser.parse1(pstate)
- } catch {
- case sde: SchemaDefinitionDiagnosticBase => {
- pstate.discard(startState)
- throw sde
- }
- }
- if (pstate.dataProc.isDefined)
pstate.dataProc.get.afterRepetition(pstate, this)
- if (pstate.processorStatus ne Success) {
- //
- // Did not succeed
- //
- // Was a discriminator set?
+ try {
+ val pstate = initialState
+ startState = initialState.mark("RepUnboundedParser1")
+ priorState = initialState.mark("RepUnboundedParser2")
+ var returnFlag = false
+ while (!returnFlag && (pstate.processorStatus eq Success)) {
+
+ // erd.maxOccurs.foreach { maxOccurs =>
--- End diff --
Delete commented code?
---