Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ abstract class ChoiceTermBase(
* Open issues:
* 1) Is alignment or leading/trailing skip to be considered syntax. Alignment might not be there.
* 2) What about an empty sequence that only carries statement annotations such as dfdl:assert or
* dfdl:setVariable
* dfdl:setVariable
*
* This latter need to be allowed, because while they do not have known required syntax they do
* have to be executed for side-effect.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ trait LocalElementMixin extends ParticleMixin with LocalElementGrammarMixin {
else if (representation =:= Representation.Binary) true
else false
}
case LengthKind.EndOfParent if isComplexType =>
notYetImplemented("lengthKind='endOfParent' for complex type")
case LengthKind.EndOfParent =>
notYetImplemented("lengthKind='endOfParent' for simple type")
// we can rarely statically know if an endOfParent element must have non-zero length
case LengthKind.EndOfParent => false
}
res
}.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,12 @@ trait ElementRuntimeValuedPropertiesMixin
case (Explicit, Text, AnySimpleType) => (lengthUnits, 0L)
case (Prefixed, _, String) => (lengthUnits, minLengthLong)
case (Prefixed, Text, _) => (lengthUnits, textOutputMinLength)
case (Pattern, _, String) => (lengthUnits, minLengthLong)
case (Pattern, Text, _) => (lengthUnits, textOutputMinLength)
case (Delimited, _, String) => (lengthUnits, minLengthLong)
case (Delimited, Text, _) => (lengthUnits, textOutputMinLength)
case (Pattern, _, String) => (LengthUnits.Characters, minLengthLong)
case (Pattern, Text, _) => (LengthUnits.Characters, textOutputMinLength)
case (Delimited, _, String) => (LengthUnits.Characters, minLengthLong)
case (Delimited, Text, _) => (LengthUnits.Characters, textOutputMinLength)
case (EndOfParent, _, String) => (LengthUnits.Characters, minLengthLong)
case (EndOfParent, Text, _) => (LengthUnits.Characters, textOutputMinLength)
case _ => (LengthUnits.Bits, 0L) // anything else. This shuts off checking a min.
}
res
Expand Down Expand Up @@ -521,10 +523,18 @@ trait ElementRuntimeValuedPropertiesMixin
((repElement.lengthKind._eq_(LengthKind.Implicit)) && repElement.isSimpleType)
) {
repElement.maybeUnparseTargetLengthInBitsEv
} else if (this.isDelimitedPrefixedPatternWithPadding) {
} else if (this.lengthKind == LengthKind.EndOfParent) {
// Per spec 12.3.6/13.2: EOP elements pad to the full "available length" of the
// enclosing box (constant-length element or explicit-length choice) when one is known.
// Fall back to minLength only when no constant box is found.
schemaSet.root.eopElementInfoMap.get(this).flatMap(_._2) match {
case Some(boxEv) => One(boxEv)
case None => if (isMinLengthKindWithPadding) One(minLengthInBitsEv) else Nope
}
} else if (this.isMinLengthKindWithPadding) {
//
// if delimited but there is a min length, we just need the min
// length. There is no target length other than it.
// if delimited/pattern/prefixed but there is a min length,
// we just need the min length. There is no target length other than it.
//
val ev = minLengthInBitsEv
One(ev)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ abstract class SequenceGroupTermBase(xml: Node, lexicalParent: SchemaComponent,
case SequenceKind.Ordered => true
case SequenceKind.Unordered => false
}

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ import org.apache.daffodil.lib.iapi.WarnID
import org.apache.daffodil.lib.schema.annotation.props.Found
import org.apache.daffodil.lib.schema.annotation.props.NotFound
import org.apache.daffodil.lib.schema.annotation.props.SeparatorSuppressionPolicy
import org.apache.daffodil.lib.schema.annotation.props.gen.LengthKind
import org.apache.daffodil.lib.schema.annotation.props.gen.OccursCountKind
import org.apache.daffodil.lib.schema.annotation.props.gen.YesNo
import org.apache.daffodil.lib.schema.annotation.props.gen.*

/**
* Mixin for objects that are shared, but have consistency checks to be run
Expand Down Expand Up @@ -562,4 +560,11 @@ trait Term
}
}

final lazy val realEOPElementChildren: Seq[ElementBase] = {
termChildren.flatMap {
case eb: ElementBase => Seq(eb)
case c: Choice => Nil
case mg: ModelGroup => mg.realEOPElementChildren
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,15 @@ trait AlignedMixin extends GrammarMixin { self: Term =>
}
case LengthKind.Delimited => encodingLengthApprox
case LengthKind.Pattern => encodingLengthApprox
case LengthKind.EndOfParent => LengthMultipleOf(1) // NYI
case LengthKind.EndOfParent =>
// Technically, the approximate length of an EndOfParent element is the length
// of its parent minus the length of prior siblings. However, this value is only
// used to compute the ending alignment available to subsequent represented terms.
// Per spec (12.3.6), no represented element or model group may follow an
// EndOfParent element (only unrepresented elements such as IVC elements are
// permitted), so the ending alignment is never consumed. LengthMultipleOf(1)
// is a safe conservative value to return.
LengthMultipleOf(1)
// If an element is lengthKind="prefixed", the element's length is the length
// of the value of the prefix element, which can't be known till runtime
case LengthKind.Prefixed => LengthMultipleOf(1) // NYI (see DAFFODIL-3066)
Expand Down
Loading
Loading