stevedlawrence commented on code in PR #1338:
URL: https://github.com/apache/daffodil/pull/1338#discussion_r1803084635
##########
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 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?
ElementBaseRuntime1Mixin has a `capturedByParsers` val that tries to list
which parsers capture their own value length. Maybe that logic isn't completely
correct, and the work around (that feels wrong) is we just always capture the
length here?
##########
daffodil-test/src/test/resources/org/apache/daffodil/section12/lengthKind/PrefixedTests.tdml:
##########
@@ -17,14 +17,14 @@
-->
<tdml:testSuite suiteName="PrefixedTests"
- description="Section 12 - lengthKind=prefixed"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:fn="http://www.w3.org/2005/xpath-functions"
- xmlns:ex="http://example.com"
- xmlns:tns="http://example.com"
- xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
- defaultRoundTrip="onePass">
+ description="Section 12 - lengthKind=prefixed"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:fn="http://www.w3.org/2005/xpath-functions"
+ xmlns:ex="http://example.com"
+ xmlns:tns="http://example.com"
+ xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
+ defaultRoundTrip="onePass"
xmlns:x="http://www.ogf.org/dfdl/dfdl-1.0/">
Review Comment:
Fix indentation.
--
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]