olabusayoT commented on code in PR #1338:
URL: https://github.com/apache/daffodil/pull/1338#discussion_r1803438203


##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SpecifiedLengthParsers.scala:
##########
@@ -85,7 +85,9 @@ sealed abstract class SpecifiedLengthParserBase(eParser: 
Parser, erd: RuntimeDat
     if (pState.processorStatus ne Success) return
     val finalEndPos0b = startingBitPos0b + nBits
 
-    captureValueLength(pState, ULong(startingBitPos0b), ULong(dis.bitPos0b))
+    // if we haven't already set the value length, set it now
+    if (pState.infoset.valueLength.isEndUndef)
+      captureValueLength(pState, ULong(startingBitPos0b), ULong(dis.bitPos0b))

Review Comment:
   > Is the issue here that some `eParsers` do not capture their own length and 
expect it to be captured here, but other parsers do capture value length 
(because they handle things like trimming), so sometimes there are two parsers 
trying to capture length for the same thing?
   
   That's right. For example, SpecifiedLengthExplicitParser doesn't capture its 
own length.
   
   > That makes me wonder if we shouldn't be capturing value length here at 
all, and instead we should be using the CaptureValueLengthStart/End parsers for 
those parsers that don't capture value length?
   
   I'll look into implementing this



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