Michael Beckerle created DAFFODIL-2132:
------------------------------------------
Summary: isKnownNotEmpty for delimiters is misused. Need
isKnownNonZeroLength for delimiters
Key: DAFFODIL-2132
URL: https://issues.apache.org/jira/browse/DAFFODIL-2132
Project: Daffodil
Issue Type: Bug
Components: Clean Ups, Middle "End"
Affects Versions: 2.3.0
Reporter: Michael Beckerle
There are many optimizations based on whether a term (element or model group)
has framing, which is defined as meaning if it has initiator/terminator, for
example, and the expressions for those satisfy "isKnownNonEmpty".
This is a bad mixup. The property being "isKnownNotEmpty" means that the
property in the schema doesn't have "" as its value.
That's not at all what is being asked of the these delimiter expressions. What
the optimizations want to know is if the delimiter is able to occupy zero bits
in the data stream, or known to require some non-zero number of bits in the
data stream.
Currently this expression:
dfdl:terminator='\{ if (...) then "%WSP*;" else "%#x7F;" }
satisfies the isKnownNonEmpty test. But depending on the predictate test, if
this returns "%WSP*;", which is allowed when dfdl:lengthKind is NOT delimited,
then this could match zero bits.
To fix this, scaladoc has been added to hasInitiator, hasTerminator, and
hasSeparator to warn about this.
But we really need to define isKnownNonZeroLength for delimiters so that
calculations for terms like isKnownNonZeroLength can be correct.
isKnownNonZeroLength can be false for delimiters that have expressions as
their values, always for initiators, and false for terminators/separators when
lengthKind is not 'delimited'. So that it does not have to involve analysis of
the expression.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)