Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2132

isKnownNotEmpty for delimiters is misused. Need isKnownNonZeroLength for delimiters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.3.0
    • None
    • Clean Ups, Middle "End"
    • None

    Description

      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.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            mbeckerle Mike Beckerle
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: