You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "stevedlawrence (via GitHub)" <gi...@apache.org> on 2023/02/13 21:19:55 UTC

[GitHub] [daffodil] stevedlawrence commented on a diff in pull request #962: Validate occurrences on rendered elements

stevedlawrence commented on code in PR #962:
URL: https://github.com/apache/daffodil/pull/962#discussion_r1105024811


##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SequenceParserBases.scala:
##########
@@ -186,6 +186,9 @@ abstract class SequenceParserBase(
               if (ais ne Done) {
                 pstate.mpstate.moveOverOneArrayIndexOnly()
               }
+              if (resultOfTry == ParseAttemptStatus.NormalRep) {
+                pstate.mpstate.incrementArrayCount()
+              }

Review Comment:
   It's not clear to me why we need this separate array counter. Does something rely on the arrayIndex to be incremented even when resultOfTry is not NormalRep?



##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/PState.scala:
##########
@@ -107,8 +107,11 @@ object MPState {
 class MPState private () {
 
   val arrayIndexStack = MStackOfLong()
+  val arrayCountStack = MStackOfLong()

Review Comment:
   I'm hoping we don't need this arrayCountStack (see other comment), but if we do, then I think we need to modify the `Mark` class in the `MPState` object at the top of this file to be able to capture and reset this state in case backtracking occurs.



-- 
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: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org