jadams-tresys commented on a change in pull request #262: Unordered sequences
URL: https://github.com/apache/incubator-daffodil/pull/262#discussion_r320270155
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/grammar/AlignedMixin.scala
##########
@@ -52,10 +52,20 @@ trait AlignedMixin extends GrammarMixin { self: Term =>
* will be properly aligned by where the prior thing left us positioned.
* Hence we are guaranteed to be properly aligned.
*/
- final def isKnownToBeAligned: Boolean = LV('isKnownToBeAligned) {
+ final lazy val isKnownToBeAligned: Boolean = LV('isKnownToBeAligned) {
if (!isRepresented) {
true
+ } else if (nearestEnclosingSequence.isDefined &&
!nearestEnclosingSequence.get.isOrdered) {
+ // Enclosed within an unordered sequence, all items in the seq
+ // must have a length that will leave the sequence aligned for
+ // isKnownToBeAligned to be true
+ val (priorSibs, optEnclosingParent) = potentialPriorTerms
+ priorSibs.forall(x => {
+ val contentAlignment =
AlignmentMultipleOf((x.elementSpecifiedLengthApprox +
x.trailingSkipApprox).nBits)
+ (contentAlignment % alignmentApprox) == 0
+ })
Review comment:
I have made changes to make this reflect the self alignment code for arrays,
which prevents the circularity errors I was getting.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services