mbeckerle commented on a change in pull request #143: Support
dfdl:length="prefixed"
URL: https://github.com/apache/incubator-daffodil/pull/143#discussion_r239913945
##########
File path:
daffodil-core/src/main/scala/org/apache/daffodil/grammar/AlignedMixin.scala
##########
@@ -125,8 +126,8 @@ trait AlignedMixin extends GrammarMixin { self: Term =>
}
private lazy val priorAlignmentApprox: AlignmentMultipleOf = {
- if (this.isInstanceOf[Root]) {
- AlignmentMultipleOf(0) // root is aligned with anything
+ if (this.isInstanceOf[Root] || this.isInstanceOf[DetachedElementDecl]) {
+ AlignmentMultipleOf(0) // root and detached elements are aligned with
anything
Review comment:
I think some of this stuff is wrong in the spec. But let's implement what it
says there, and then consider correcting it.
I believe none of the properties on an element having lengthKind 'prefixed'
should affect the representation of the prefix itself. Properties like
prefixIncludesPrefixLength affect the interpretation of the value from that
prefix, but not the representation of the prefix.
I believe all properties that are supposed to apply to the prefix itself
must be expressed on a simple type definition. There should be no property
combining between the prefix's simple type, i.e., the pseudo-element you create
for it, and the element having that prefix type.
Let's take the case of a string with a 4-byte binary integer as prefix
length. The integer has to be 32-bit aligned.
Properties on the element want to be those associated with a textual string,
not those for a binary integer.
Consider a harder case: Consider the prefix length is itself a text integer,
giving the length of another text integer. Then if the property
dfdl:textNumberJustification and dfdl:textTrimKind, etc. appear on the element,
do those apply to the element, the prefix or both. I claim they apply ONLY to
the element, NOT to the prefix. Any properties for the prefix have to be
expressed on the simple type definition, which will have to be a named type
definition someplace if any properties are needed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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