jadams-tresys commented on code in PR #987:
URL: https://github.com/apache/daffodil/pull/987#discussion_r1907378584


##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/PState.scala:
##########
@@ -588,6 +589,23 @@ final class PState private (
     }
   }
 
+  /**
+   * This function is used for cases where a parse must be performed after 
there
+   * has already been a failed parse of an enclosing element/sequence. Most
+   * common example of this would be a choice branch containing a sequence with
+   * an annotated assert expression. According to 9.5.2 of the DFDL spec this
+   * assert expression needs to be parsed regardless of whether or not the
+   * enclosing sequence content parses or not as the assert expression may be
+   * used as a discriminator for the choice branch.
+   */
+  def withTempSuccess(func: (PState) => Unit): Unit = {
+    val priorProcessorStatus = processorStatus
+    setSuccess()
+    func(this)
+    if (processorStatus eq Success)
+      _processorStatus = priorProcessorStatus

Review Comment:
   I modeled withTempSuccess after the withPointOfUncertainty function, so that 
is why it is using a labmda here.  I vaguely recall tasking with @mbeckerle 
about this function, but I could be mis-remembering things.
   
   I'll make the change to not be conditionally changing the processStatus.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to