olabusayoT opened a new pull request, #1680:
URL: https://github.com/apache/daffodil/pull/1680

    - Primary bug (seq2): in a postfix-separated anyEmpty sequence, when an 
optional complex element contains a dfdl:discriminator that evaluates to true 
(committing to that element) and the child parses successfully, but the postfix 
separator is subsequently not found, Daffodil aborted with an internal 
Assert.invariant failure instead of producing a clean "Failed to find postfix 
separator" parse error. The discriminator had already resolved the outer PoU, 
so the subsequent unconditional 
Assert.invariant(!pstate.isPointOfUncertaintyResolved(pou)) in the 
child-successful+sep-failed path fired. This was fixed by checking 
isPointOfUncertaintyResolved before deciding to resetToPointOfUncertainty (undo 
the entire parse attempt since the mark was created) vs 
resolvePointOfUncertainty (commit to whatever was just parsed, just clean up 
the checkpoint).
    - Related bug (seq3): in the same postfix+anyEmpty configuration, an 
optional simple-delimited element with zero-length content followed by its 
separator which should be AbsentRep per DFDL spec 9.2.4 was not recognized as 
absent, causing the sequence to stop prematurely instead of continuing to the 
next child. Two necessary fixes:
    -- PostfixSeparatorHelper's child-failed+sep-found path called 
computeParseAttemptStatus with the post-separator bit position, making the isZL 
flag incorrect. Switch to computeFailedParseAttemptStatus with 
hasZLChildAttempt (captured before sep.parse1). A second Assert.invariant in 
the isSimpleDelimited guard of the same path is replaced by folding the 
PoU-resolved check into the condition. Then promote MissingItem to AbsentRep 
for non-positional optional elements per the spec.
    -- The outer scalar loop's AbsentRep case unconditionally set isDone=true. 
Check Separated.isPositional, and for non-positional (anyEmpty) elements we 
call moveOverOneGroupIndexOnly and continue, while for positional elements we 
keep the existing trailing-suppression isDone=true behavior.
    - removed an erroneous setBitPos0b(currentPos) from the 
MissingItem+optional+pou branch in parseOneInstanceWithMaybePoU that 
incorrectly skipped past a prefix/infix separator needed by the next element.
    - added tests seq2–seq7: discriminator+missing-sep error, 
absent-then-present non-positional, required-element-absent error, positional 
trailingEmpty isDone path, both-absent non-positional, and present-then-absent 
non-positional.
   
    DAFFODIL-3085


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