mbeckerle commented on a change in pull request #12: Revised daffodil-io module to require passing in a FormatInfo object. URL: https://github.com/apache/incubator-daffodil/pull/12#discussion_r158078171
########## File path: daffodil-core/src/main/scala/edu/illinois/ncsa/daffodil/grammar/BitOrderMixin.scala ########## @@ -79,8 +87,29 @@ trait BitOrderMixin extends GrammarMixin with ByteOrderAnalysisMixin { self: Ter (isArray && !hasUniformBitOrderThroughout))) } - protected final lazy val bitOrderChange = prod("bitOrderChange", needsBitOrderChange) { - BitOrderChange(this) + // + // protected final lazy val bitOrderChange = prod("bitOrderChange", needsBitOrderChange) { + // BitOrderChange(this) + // } + + private lazy val checkByteAndBitOrder = { + val ev = new CheckByteAndBitOrderEv(termRuntimeData, defaultBitOrder) + ev.compile() + ev } + lazy val maybeCheckByteAndBitOrderEv = + if (optionByteOrderRaw.isDefined) Maybe(checkByteAndBitOrder) + else Maybe.Nope + + private lazy val checkBitOrderAndCharset = { + val ev = new CheckBitOrderAndCharsetEv(termRuntimeData, defaultBitOrder, charsetEv) + ev.compile() + ev + } + + lazy val maybeCheckBitOrderAndCharset = + if (this.optionEncodingRaw.isDefined) Maybe(checkBitOrderAndCharset) Review comment: A binary element can have an initiator or terminator and those will be expressed in the current charset encoding. So even if representation is binary, one can have other textual syntax surrounding the element. Using raw-bytes notation or encoding iso-8859-1 this could even be useful. So really the test ought to be not is encoding defined, but "is there any text?". I think we have this in the lattice that is used to determine if things are scannable. That can confirm things are binary-only, as in binary and does not have delimiters. As you point out, things that are purely binary don't need this check. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services