diff --git a/daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/DaffodilCCodeGenerator.scala b/daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/DaffodilCCodeGenerator.scala index 959d97e337..62922f56a8 100644 --- a/daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/DaffodilCCodeGenerator.scala +++ b/daffodil-codegen-c/src/main/scala/org/apache/daffodil/codegen/c/DaffodilCCodeGenerator.scala @@ -59,6 +59,7 @@ import org.apache.daffodil.core.grammar.primitives.RightFill import org.apache.daffodil.core.grammar.primitives.ScalarOrderedSequenceChild import org.apache.daffodil.core.grammar.primitives.SpecifiedLengthExplicit import org.apache.daffodil.core.grammar.primitives.SpecifiedLengthImplicit +import org.apache.daffodil.core.grammar.primitives.SpecifiedLengthPrefixed import org.apache.daffodil.lib.api.Diagnostic import org.apache.daffodil.lib.api.WarnID import org.apache.daffodil.lib.schema.annotation.props.gen.FailureType @@ -301,6 +302,7 @@ object DaffodilCCodeGenerator case g: SeqComp => seqCompGenerateCode(g, cgState) case g: SpecifiedLengthExplicit => specifiedLengthExplicit(g, cgState) case g: SpecifiedLengthImplicit => specifiedLengthImplicit(g, cgState) + case g: SpecifiedLengthPrefixed => specifiedLengthPrefixed(g, cgState) case _ => gram.SDE("Code generation not supported for: %s", Misc.getNameFromClass(gram)) } } @@ -409,4 +411,11 @@ object DaffodilCCodeGenerator ): Unit = { DaffodilCCodeGenerator.generateCode(g.eGram, cgState) } + + private def specifiedLengthPrefixed( + g: SpecifiedLengthPrefixed, + cgState: CodeGeneratorState + ): Unit = { + DaffodilCCodeGenerator.generateCode(g.eGram, cgState) + } } diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ElementBaseGrammarMixin.scala b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ElementBaseGrammarMixin.scala index f9982d71a4..cb28440f66 100644 --- a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ElementBaseGrammarMixin.scala +++ b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ElementBaseGrammarMixin.scala @@ -72,13 +72,21 @@ trait ElementBaseGrammarMixin } } - protected lazy val isDelimitedPrefixedPattern = { + protected lazy val isPrefixed: Boolean = { + import LengthKind._ + lengthKind match { + case Prefixed => true + case _ => false + } + } + + protected lazy val isDelimitedPrefixedPattern: Boolean = { import LengthKind._ lengthKind match { case Delimited => true // don't test for hasDelimiters because it might not be our delimiter, but a surrounding group's separator, or it's terminator, etc. case Pattern => true - case Prefixed => true + case Prefixed => isPrefixed case _ => false } } @@ -474,12 +482,16 @@ trait ElementBaseGrammarMixin lazy val leftPadding = leftPaddingArg lazy val rightPadFill = rightPadFillArg lazy val body = bodyArg - CaptureContentLengthStart(this) ~ - leftPadding ~ - CaptureValueLengthStart(this) ~ - body ~ - CaptureValueLengthEnd(this) ~ - rightPadFill ~ + specifiedLength( + CaptureContentLengthStart(this) ~ + leftPadding ~ + CaptureValueLengthStart(this) ~ + body ~ + CaptureValueLengthEnd(this) ~ + rightPadFill + ) ~ + // CaptureContentLengthEnd must be outside the specified length so it can + // do any skipping of bits it needs to before capturing the end of content length CaptureContentLengthEnd(this) } @@ -623,14 +635,14 @@ trait ElementBaseGrammarMixin private lazy val stringPrim = { lengthKind match { - case LengthKind.Explicit => specifiedLength(StringOfSpecifiedLength(this)) - case LengthKind.Prefixed => specifiedLength(StringOfSpecifiedLength(this)) + case LengthKind.Explicit => StringOfSpecifiedLength(this) + case LengthKind.Prefixed => StringOfSpecifiedLength(this) case LengthKind.Delimited => stringDelimitedEndOfData - case LengthKind.Pattern => specifiedLength(StringOfSpecifiedLength(this)) + case LengthKind.Pattern => StringOfSpecifiedLength(this) case LengthKind.Implicit => { val pt = this.simpleType.primType Assert.invariant(pt == PrimType.String) - specifiedLength(StringOfSpecifiedLength(this)) + StringOfSpecifiedLength(this) } case LengthKind.EndOfParent if isComplexType => notYetImplemented("lengthKind='endOfParent' for complex type") @@ -645,7 +657,7 @@ trait ElementBaseGrammarMixin } private lazy val hexBinaryLengthPattern = prod("hexBinaryLengthPattern") { - new SpecifiedLengthPattern(this, new HexBinaryEndOfBitLimit(this)) + new HexBinaryEndOfBitLimit(this) } private lazy val hexBinaryLengthPrefixed = prod("hexBinaryLengthPrefixed") { @@ -1226,7 +1238,7 @@ trait ElementBaseGrammarMixin } private lazy val nilLitSimple = prod("nilLitSimple", isSimpleType) { - captureLengthRegions(leftPadding, specifiedLength(nilLitContent), rightPadding ~ rightFill) + captureLengthRegions(leftPadding, nilLitContent, rightPadding ~ rightFill) } private lazy val nilLitComplex = prod("nilLitComplex", isComplexType) { @@ -1329,7 +1341,10 @@ trait ElementBaseGrammarMixin * as well, by not enclosing the body in a specified length enforcer. */ private def specifiedLength(bodyArg: => Gram) = { - lazy val body = bodyArg + // we need this to evaluate before we wrap in specified length parser, + // so it can do any internal checks for example blobValue's check for + // non-explicit lengthKind + val body = bodyArg lazy val bitsMultiplier = lengthUnits match { case LengthUnits.Bits => 1 case LengthUnits.Bytes => 8 @@ -1341,7 +1356,13 @@ trait ElementBaseGrammarMixin case LengthKind.Delimited => body case LengthKind.Pattern => new SpecifiedLengthPattern(this, body) case LengthKind.Explicit if bitsMultiplier != 0 => - new SpecifiedLengthExplicit(this, body, bitsMultiplier) + if (isSimpleType && primType == PrimType.HexBinary) { + // hexBinary has some checks that need to be done that SpecifiedLengthExplicit + // gets in the way of + body + } else { + new SpecifiedLengthExplicit(this, body, bitsMultiplier) + } case LengthKind.Explicit => { Assert.invariant(!knownEncodingIsFixedWidth) Assert.invariant(lengthUnits eq LengthUnits.Characters) @@ -1403,7 +1424,7 @@ trait ElementBaseGrammarMixin private lazy val sharedComplexContentRegion: Gram = schemaSet.sharedComplexContentFactory.getShared( shareKey, - captureLengthRegions(EmptyGram, specifiedLength(complexContent), elementUnused) ~ + captureLengthRegions(EmptyGram, complexContent, elementUnused) ~ terminatorRegion ) diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesBCD.scala b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesBCD.scala index 550daffa76..879b81d91b 100644 --- a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesBCD.scala +++ b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesBCD.scala @@ -52,20 +52,10 @@ class BCDIntegerKnownLength(val e: ElementBase, lengthInBits: Long) extends Term class BCDIntegerPrefixedLength(val e: ElementBase) extends Terminal(e, true) { - override lazy val parser = new BCDIntegerPrefixedLengthParser( - e.elementRuntimeData, - e.prefixedLengthBody.parser, - e.prefixedLengthElementDecl.elementRuntimeData, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits - ) + override lazy val parser = new BCDIntegerPrefixedLengthParser(e.elementRuntimeData) override lazy val unparser: Unparser = new BCDIntegerPrefixedLengthUnparser( - e.elementRuntimeData, - e.prefixedLengthBody.unparser, - e.prefixedLengthElementDecl.elementRuntimeData, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits + e.elementRuntimeData ) } @@ -102,21 +92,9 @@ class BCDDecimalKnownLength(val e: ElementBase, lengthInBits: Long) extends Term class BCDDecimalPrefixedLength(val e: ElementBase) extends Terminal(e, true) { - override lazy val parser = new BCDDecimalPrefixedLengthParser( - e.elementRuntimeData, - e.prefixedLengthBody.parser, - e.prefixedLengthElementDecl.elementRuntimeData, - e.binaryDecimalVirtualPoint, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits - ) + override lazy val parser = + new BCDDecimalPrefixedLengthParser(e.elementRuntimeData, e.binaryDecimalVirtualPoint) - override lazy val unparser: Unparser = new BCDDecimalPrefixedLengthUnparser( - e.elementRuntimeData, - e.prefixedLengthBody.unparser, - e.prefixedLengthElementDecl.elementRuntimeData, - e.binaryDecimalVirtualPoint, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits - ) + override lazy val unparser: Unparser = + new BCDDecimalPrefixedLengthUnparser(e.elementRuntimeData, e.binaryDecimalVirtualPoint) } diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesBinaryBoolean.scala b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesBinaryBoolean.scala index 05a6dfd9b8..1f4865ff59 100644 --- a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesBinaryBoolean.scala +++ b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesBinaryBoolean.scala @@ -48,21 +48,15 @@ class BinaryBoolean(val e: ElementBase) extends Terminal(e, true) { class BinaryBooleanPrefixedLength(val e: ElementBase) extends Terminal(e, true) { override lazy val parser = new BinaryBooleanPrefixedLengthParser( e.elementRuntimeData, - e.prefixedLengthBody.parser, - e.prefixedLengthElementDecl.elementRuntimeData, e.binaryBooleanTrueRep, e.binaryBooleanFalseRep, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits + e.lengthUnits ) override lazy val unparser: Unparser = new BinaryBooleanPrefixedLengthUnparser( e.elementRuntimeData, - e.prefixedLengthBody.unparser, - e.prefixedLengthElementDecl.elementRuntimeData, e.binaryBooleanTrueRep, e.binaryBooleanFalseRep, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits + e.lengthUnits ) } diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesBinaryNumber.scala b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesBinaryNumber.scala index 2fbcad59e4..92204f409c 100644 --- a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesBinaryNumber.scala +++ b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesBinaryNumber.scala @@ -77,14 +77,7 @@ class BinaryIntegerPrefixedLength(val e: ElementBase, signed: Boolean) private lazy val pladj = e.prefixedLengthAdjustmentInUnits override lazy val parser = - new BinaryIntegerPrefixedLengthParser( - erd, - e.prefixedLengthBody.parser, - plerd, - signed, - e.lengthUnits, - pladj - ) + new BinaryIntegerPrefixedLengthParser(erd, signed) override lazy val unparser: Unparser = { val maybeNBits = e.primType match { @@ -96,15 +89,7 @@ class BinaryIntegerPrefixedLength(val e: ElementBase, signed: Boolean) case _ => Assert.invariantFailed("Only integer base types should be used for this primitive") } - new BinaryIntegerPrefixedLengthUnparser( - erd, - e.prefixedLengthBody.unparser, - plerd, - maybeNBits, - signed, - e.lengthUnits, - pladj - ) + new BinaryIntegerPrefixedLengthUnparser(erd, maybeNBits, signed) } } @@ -151,23 +136,15 @@ class BinaryDecimalPrefixedLength(val e: ElementBase) extends Terminal(e, true) override lazy val parser = new BinaryDecimalPrefixedLengthParser( e.elementRuntimeData, - e.prefixedLengthBody.parser, - e.prefixedLengthElementDecl.elementRuntimeData, e.decimalSigned, - e.binaryDecimalVirtualPoint, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits + e.binaryDecimalVirtualPoint ) override lazy val unparser: Unparser = new BinaryDecimalPrefixedLengthUnparser( e.elementRuntimeData, - e.prefixedLengthBody.unparser, - e.prefixedLengthElementDecl.elementRuntimeData, e.decimalSigned, - e.binaryDecimalVirtualPoint, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits + e.binaryDecimalVirtualPoint ) } diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesIBM4690Packed.scala b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesIBM4690Packed.scala index 152af02cba..955a6c097c 100644 --- a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesIBM4690Packed.scala +++ b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesIBM4690Packed.scala @@ -61,21 +61,11 @@ class IBM4690PackedIntegerKnownLength(val e: ElementBase, signed: Boolean, lengt class IBM4690PackedIntegerPrefixedLength(val e: ElementBase, signed: Boolean) extends Terminal(e, true) { - override lazy val parser = new IBM4690PackedIntegerPrefixedLengthParser( - e.elementRuntimeData, - e.prefixedLengthBody.parser, - e.prefixedLengthElementDecl.elementRuntimeData, - signed, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits - ) + override lazy val parser = + new IBM4690PackedIntegerPrefixedLengthParser(e.elementRuntimeData, signed) override lazy val unparser: Unparser = new IBM4690PackedIntegerPrefixedLengthUnparser( - e.elementRuntimeData, - e.prefixedLengthBody.unparser, - e.prefixedLengthElementDecl.elementRuntimeData, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits + e.elementRuntimeData ) } @@ -114,19 +104,11 @@ class IBM4690PackedDecimalKnownLength(val e: ElementBase, lengthInBits: Long) class IBM4690PackedDecimalPrefixedLength(val e: ElementBase) extends Terminal(e, true) { override lazy val parser = new IBM4690PackedDecimalPrefixedLengthParser( e.elementRuntimeData, - e.prefixedLengthBody.parser, - e.prefixedLengthElementDecl.elementRuntimeData, - e.binaryDecimalVirtualPoint, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits + e.binaryDecimalVirtualPoint ) override lazy val unparser: Unparser = new IBM4690PackedDecimalPrefixedLengthUnparser( e.elementRuntimeData, - e.prefixedLengthBody.unparser, - e.prefixedLengthElementDecl.elementRuntimeData, - e.binaryDecimalVirtualPoint, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits + e.binaryDecimalVirtualPoint ) } diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesLengthKind.scala b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesLengthKind.scala index 9459267ce0..20107e94db 100644 --- a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesLengthKind.scala +++ b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesLengthKind.scala @@ -48,7 +48,6 @@ import org.apache.daffodil.runtime1.processors.unparsers.{ Unparser => DaffodilU import org.apache.daffodil.unparsers.runtime1.BCDDecimalDelimitedUnparser import org.apache.daffodil.unparsers.runtime1.BCDIntegerDelimitedUnparser import org.apache.daffodil.unparsers.runtime1.BlobSpecifiedLengthUnparser -import org.apache.daffodil.unparsers.runtime1.HexBinaryLengthPrefixedUnparser import org.apache.daffodil.unparsers.runtime1.HexBinaryMinLengthInBytesUnparser import org.apache.daffodil.unparsers.runtime1.HexBinarySpecifiedLengthUnparser import org.apache.daffodil.unparsers.runtime1.IBM4690PackedDecimalDelimitedUnparser @@ -186,21 +185,11 @@ case class HexBinaryEndOfBitLimit(e: ElementBase) extends Terminal(e, true) { case class HexBinaryLengthPrefixed(e: ElementBase) extends Terminal(e, true) { override lazy val parser: DaffodilParser = new HexBinaryLengthPrefixedParser( - e.elementRuntimeData, - e.prefixedLengthBody.parser, - e.prefixedLengthElementDecl.elementRuntimeData, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits + e.elementRuntimeData ) - override lazy val unparser: DaffodilUnparser = new HexBinaryLengthPrefixedUnparser( - e.elementRuntimeData, - e.prefixedLengthBody.unparser, - e.prefixedLengthElementDecl.elementRuntimeData, - e.minLength.longValue, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits - ) + override lazy val unparser: DaffodilUnparser = + new HexBinaryMinLengthInBytesUnparser(e.minLength.longValue, e.elementRuntimeData) } abstract class PackedIntegerDelimited( diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesPacked.scala b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesPacked.scala index fef8199c69..a99993cd86 100644 --- a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesPacked.scala +++ b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/primitives/PrimitivesPacked.scala @@ -82,24 +82,11 @@ class PackedIntegerPrefixedLength( packedSignCodes: PackedSignCodes ) extends Terminal(e, true) { - override lazy val parser = new PackedIntegerPrefixedLengthParser( - e.elementRuntimeData, - e.prefixedLengthBody.parser, - e.prefixedLengthElementDecl.elementRuntimeData, - signed, - packedSignCodes, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits - ) + override lazy val parser = + new PackedIntegerPrefixedLengthParser(e.elementRuntimeData, signed, packedSignCodes) - override lazy val unparser: Unparser = new PackedIntegerPrefixedLengthUnparser( - e.elementRuntimeData, - e.prefixedLengthBody.unparser, - e.prefixedLengthElementDecl.elementRuntimeData, - packedSignCodes, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits - ) + override lazy val unparser: Unparser = + new PackedIntegerPrefixedLengthUnparser(e.elementRuntimeData, packedSignCodes) } class PackedDecimalRuntimeLength(val e: ElementBase, packedSignCodes: PackedSignCodes) @@ -147,21 +134,13 @@ class PackedDecimalPrefixedLength(val e: ElementBase, packedSignCodes: PackedSig override lazy val parser = new PackedDecimalPrefixedLengthParser( e.elementRuntimeData, - e.prefixedLengthBody.parser, - e.prefixedLengthElementDecl.elementRuntimeData, e.binaryDecimalVirtualPoint, - packedSignCodes, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits + packedSignCodes ) override lazy val unparser: Unparser = new PackedDecimalPrefixedLengthUnparser( e.elementRuntimeData, - e.prefixedLengthBody.unparser, - e.prefixedLengthElementDecl.elementRuntimeData, e.binaryDecimalVirtualPoint, - packedSignCodes, - e.lengthUnits, - e.prefixedLengthAdjustmentInUnits + packedSignCodes ) } diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/core/runtime1/ElementBaseRuntime1Mixin.scala b/daffodil-core/src/main/scala/org/apache/daffodil/core/runtime1/ElementBaseRuntime1Mixin.scala index d9d26a73e0..98410d787f 100644 --- a/daffodil-core/src/main/scala/org/apache/daffodil/core/runtime1/ElementBaseRuntime1Mixin.scala +++ b/daffodil-core/src/main/scala/org/apache/daffodil/core/runtime1/ElementBaseRuntime1Mixin.scala @@ -24,9 +24,9 @@ import org.apache.daffodil.core.dsom.PrimitiveType import org.apache.daffodil.core.dsom.Root import org.apache.daffodil.core.dsom.SimpleTypeDefBase import org.apache.daffodil.lib.schema.annotation.props.gen.LengthKind +import org.apache.daffodil.lib.schema.annotation.props.gen.Representation.Text import org.apache.daffodil.lib.util.Delay import org.apache.daffodil.lib.util.Maybe -import org.apache.daffodil.runtime1.dpath.NodeInfo.PrimType import org.apache.daffodil.runtime1.dsom.DPathElementCompileInfo import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.RuntimeData @@ -65,7 +65,8 @@ trait ElementBaseRuntime1Mixin { self: ElementBase => // no reason (unless it is referenced in a contentLength expression). val mightHaveSuspensions = (maybeFixedLengthInBits.isDefined && couldHaveSuspensions) - isReferenced || mightHaveSuspensions + // we want to capture contentlength when LK = prefixed + lengthKind == LengthKind.Prefixed || isReferenced || mightHaveSuspensions } /** @@ -97,8 +98,7 @@ trait ElementBaseRuntime1Mixin { self: ElementBase => // Capture{Start,End}OfValueLengthParsers, since those lengths are captured // by the value parsers val capturedByValueParsers = - (isSimpleType && ( - primType == PrimType.String || lengthKind == LengthKind.Delimited)) || + (isSimpleType && (impliedRepresentation == Text || lengthKind == LengthKind.Delimited)) || (isComplexType && (lengthKind != LengthKind.Implicit && lengthKind != LengthKind.Delimited)) !capturedByValueParsers && isReferenced diff --git a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/BCDUnparsers.scala b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/BCDUnparsers.scala index 84dde6a128..68d1ec207a 100644 --- a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/BCDUnparsers.scala +++ b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/BCDUnparsers.scala @@ -25,7 +25,6 @@ import org.apache.daffodil.lib.util.DecimalUtils import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.Evaluatable import org.apache.daffodil.runtime1.processors.ParseOrUnparseState -import org.apache.daffodil.runtime1.processors.Processor import org.apache.daffodil.runtime1.processors.parsers.HasKnownLengthInBits import org.apache.daffodil.runtime1.processors.parsers.HasRuntimeExplicitLength import org.apache.daffodil.runtime1.processors.unparsers._ @@ -57,16 +56,9 @@ final class BCDIntegerDelimitedUnparser(e: ElementRuntimeData) override def getBitLength(state: ParseOrUnparseState): Int = { 0 } } -final class BCDIntegerPrefixedLengthUnparser( - e: ElementRuntimeData, - override val prefixedLengthUnparser: Unparser, - override val prefixedLengthERD: ElementRuntimeData, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends BCDIntegerBaseUnparser(e) - with KnownPrefixedLengthUnparserMixin { +final class BCDIntegerPrefixedLengthUnparser(e: ElementRuntimeData) + extends BCDIntegerBaseUnparser(e) { - override def childProcessors: Vector[Processor] = Vector(prefixedLengthUnparser) override lazy val runtimeDependencies = Vector() override def getBitLength(s: ParseOrUnparseState): Int = { @@ -75,11 +67,6 @@ final class BCDIntegerPrefixedLengthUnparser( val (byteLength, _) = DecimalUtils.bcdFromBigIntegerLength(absBigIntStr, 0) byteLength * 8 } - - override def unparse(state: UState): Unit = { - unparsePrefixedLength(state) - super.unparse(state) - } } abstract class BCDDecimalBaseUnparser(e: ElementRuntimeData, binaryDecimalVirtualPoint: Int) @@ -115,15 +102,9 @@ final class BCDDecimalDelimitedUnparser(e: ElementRuntimeData, binaryDecimalVirt final class BCDDecimalPrefixedLengthUnparser( e: ElementRuntimeData, - override val prefixedLengthUnparser: Unparser, - override val prefixedLengthERD: ElementRuntimeData, - binaryDecimalVirtualPoint: Int, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends BCDDecimalBaseUnparser(e, binaryDecimalVirtualPoint) - with KnownPrefixedLengthUnparserMixin { + binaryDecimalVirtualPoint: Int +) extends BCDDecimalBaseUnparser(e, binaryDecimalVirtualPoint) { - override def childProcessors: Vector[Processor] = Vector(prefixedLengthUnparser) override lazy val runtimeDependencies = Vector() override def getBitLength(s: ParseOrUnparseState): Int = { @@ -132,9 +113,4 @@ final class BCDDecimalPrefixedLengthUnparser( val (byteLength, _) = DecimalUtils.bcdFromBigIntegerLength(absBigIntStr, 0) byteLength * 8 } - - override def unparse(state: UState): Unit = { - unparsePrefixedLength(state) - super.unparse(state) - } } diff --git a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/BinaryBooleanUnparsers.scala b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/BinaryBooleanUnparsers.scala index 8f57d2b59a..bb329e8904 100644 --- a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/BinaryBooleanUnparsers.scala +++ b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/BinaryBooleanUnparsers.scala @@ -30,7 +30,6 @@ import org.apache.daffodil.lib.util.Numbers import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.Evaluatable import org.apache.daffodil.runtime1.processors.ParseOrUnparseState -import org.apache.daffodil.runtime1.processors.Processor import org.apache.daffodil.runtime1.processors.unparsers._ import passera.unsigned.ULong @@ -131,24 +130,18 @@ class BinaryBooleanUnparser( class BinaryBooleanPrefixedLengthUnparser( e: ElementRuntimeData, - override val prefixedLengthUnparser: Unparser, - override val prefixedLengthERD: ElementRuntimeData, binaryBooleanTrueRep: MaybeULong, binaryBooleanFalseRep: ULong, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends BinaryBooleanUnparserBase(e, binaryBooleanTrueRep, binaryBooleanFalseRep, lengthUnits) - with KnownPrefixedLengthUnparserMixin { - - override def childProcessors: Vector[Processor] = Vector(prefixedLengthUnparser) + lengthUnits: LengthUnits +) extends BinaryBooleanUnparserBase( + e, + binaryBooleanTrueRep, + binaryBooleanFalseRep, + lengthUnits + ) { override lazy val runtimeDependencies = Vector() override def getBitLength(s: ParseOrUnparseState): Int = 32 - override def unparse(state: UState): Unit = { - unparsePrefixedLength(state) - super.unparse(state) - } - } diff --git a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/BinaryNumberUnparsers.scala b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/BinaryNumberUnparsers.scala index 2c5745fba0..dea17446b2 100644 --- a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/BinaryNumberUnparsers.scala +++ b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/BinaryNumberUnparsers.scala @@ -30,7 +30,6 @@ import org.apache.daffodil.lib.util.Numbers._ import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.Evaluatable import org.apache.daffodil.runtime1.processors.ParseOrUnparseState -import org.apache.daffodil.runtime1.processors.Processor import org.apache.daffodil.runtime1.processors.parsers.HasKnownLengthInBits import org.apache.daffodil.runtime1.processors.parsers.HasRuntimeExplicitLength import org.apache.daffodil.runtime1.processors.unparsers._ @@ -119,16 +118,10 @@ class BinaryIntegerRuntimeLengthUnparser( class BinaryIntegerPrefixedLengthUnparser( e: ElementRuntimeData, - override val prefixedLengthUnparser: Unparser, - override val prefixedLengthERD: ElementRuntimeData, maybeNBits: MaybeInt, - signed: Boolean, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends BinaryIntegerBaseUnparser(e: ElementRuntimeData, signed: Boolean) - with KnownPrefixedLengthUnparserMixin { + signed: Boolean +) extends BinaryIntegerBaseUnparser(e: ElementRuntimeData, signed: Boolean) { - override def childProcessors: Vector[Processor] = Vector(prefixedLengthUnparser) override lazy val runtimeDependencies = Vector() override def getBitLength(s: ParseOrUnparseState): Int = { @@ -144,11 +137,6 @@ class BinaryIntegerPrefixedLengthUnparser( (signedLen + 7) & ~0x7 // round up to nearest multilpe of 8 } } - - override def unparse(state: UState): Unit = { - unparsePrefixedLength(state) - super.unparse(state) - } } class BinaryFloatUnparser(e: ElementRuntimeData) extends BinaryNumberBaseUnparser(e) { @@ -210,16 +198,10 @@ class BinaryDecimalRuntimeLengthUnparser( class BinaryDecimalPrefixedLengthUnparser( e: ElementRuntimeData, - override val prefixedLengthUnparser: Unparser, - override val prefixedLengthERD: ElementRuntimeData, signed: YesNo, - binaryDecimalVirtualPoint: Int, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends BinaryDecimalUnparserBase(e, signed, binaryDecimalVirtualPoint) - with KnownPrefixedLengthUnparserMixin { + binaryDecimalVirtualPoint: Int +) extends BinaryDecimalUnparserBase(e, signed, binaryDecimalVirtualPoint) { - override def childProcessors: Vector[Processor] = Vector(prefixedLengthUnparser) override lazy val runtimeDependencies = Vector() override def getBitLength(s: ParseOrUnparseState): Int = { @@ -230,11 +212,6 @@ class BinaryDecimalPrefixedLengthUnparser( val signedLen = if (signed == YesNo.Yes) len + 1 else len (signedLen + 7) & ~0x7 // round up to nearest multilpe of 8 } - - override def unparse(state: UState): Unit = { - unparsePrefixedLength(state) - super.unparse(state) - } } abstract class BinaryDecimalUnparserBase( diff --git a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/HexBinaryLengthUnparser.scala b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/HexBinaryLengthUnparser.scala index 6fa3d845e7..2bd7d316ff 100644 --- a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/HexBinaryLengthUnparser.scala +++ b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/HexBinaryLengthUnparser.scala @@ -18,12 +18,9 @@ package org.apache.daffodil.unparsers.runtime1 import org.apache.daffodil.lib.exceptions.Assert -import org.apache.daffodil.lib.schema.annotation.props.gen.LengthUnits import org.apache.daffodil.lib.util.Maybe._ import org.apache.daffodil.runtime1.infoset.RetryableException import org.apache.daffodil.runtime1.processors.ElementRuntimeData -import org.apache.daffodil.runtime1.processors.ParseOrUnparseState -import org.apache.daffodil.runtime1.processors.Processor import org.apache.daffodil.runtime1.processors.UnparseTargetLengthInBitsEv import org.apache.daffodil.runtime1.processors.unparsers._ @@ -129,26 +126,3 @@ final class HexBinarySpecifiedLengthUnparser( l } } - -final class HexBinaryLengthPrefixedUnparser( - erd: ElementRuntimeData, - override val prefixedLengthUnparser: Unparser, - override val prefixedLengthERD: ElementRuntimeData, - minLengthInBytes: Long, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends HexBinaryMinLengthInBytesUnparser(minLengthInBytes, erd) - with KnownPrefixedLengthUnparserMixin { - - override def childProcessors: Vector[Processor] = Vector(prefixedLengthUnparser) - - override def getBitLength(state: ParseOrUnparseState): Int = { - val bits = getLengthInBits(state.asInstanceOf[UState]) - bits.toInt - } - - override def unparse(state: UState): Unit = { - unparsePrefixedLength(state) - super.unparse(state) - } -} diff --git a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/IBM4690PackedDecimalUnparsers.scala b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/IBM4690PackedDecimalUnparsers.scala index c401643e7e..5dba1cf8ba 100644 --- a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/IBM4690PackedDecimalUnparsers.scala +++ b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/IBM4690PackedDecimalUnparsers.scala @@ -25,7 +25,6 @@ import org.apache.daffodil.lib.util.DecimalUtils import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.Evaluatable import org.apache.daffodil.runtime1.processors.ParseOrUnparseState -import org.apache.daffodil.runtime1.processors.Processor import org.apache.daffodil.runtime1.processors.parsers.HasKnownLengthInBits import org.apache.daffodil.runtime1.processors.parsers.HasRuntimeExplicitLength import org.apache.daffodil.runtime1.processors.unparsers._ @@ -59,16 +58,9 @@ final class IBM4690PackedIntegerDelimitedUnparser(e: ElementRuntimeData) override def getBitLength(state: ParseOrUnparseState): Int = { 0 } } -final class IBM4690PackedIntegerPrefixedLengthUnparser( - e: ElementRuntimeData, - override val prefixedLengthUnparser: Unparser, - override val prefixedLengthERD: ElementRuntimeData, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends IBM4690PackedIntegerBaseUnparser(e) - with KnownPrefixedLengthUnparserMixin { +final class IBM4690PackedIntegerPrefixedLengthUnparser(e: ElementRuntimeData) + extends IBM4690PackedIntegerBaseUnparser(e) { - override def childProcessors: Vector[Processor] = Vector(prefixedLengthUnparser) override lazy val runtimeDependencies = Vector() override def getBitLength(s: ParseOrUnparseState): Int = { @@ -79,11 +71,6 @@ final class IBM4690PackedIntegerPrefixedLengthUnparser( val (byteLength, _) = DecimalUtils.ibm4690FromBigIntegerLength(absBigIntStr, 0, negative) byteLength * 8 } - - override def unparse(state: UState): Unit = { - unparsePrefixedLength(state) - super.unparse(state) - } } abstract class IBM4690PackedDecimalBaseUnparser( @@ -123,15 +110,9 @@ final class IBM4690PackedDecimalDelimitedUnparser( final class IBM4690PackedDecimalPrefixedLengthUnparser( e: ElementRuntimeData, - override val prefixedLengthUnparser: Unparser, - override val prefixedLengthERD: ElementRuntimeData, - binaryDecimalVirtualPoint: Int, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends IBM4690PackedDecimalBaseUnparser(e, binaryDecimalVirtualPoint) - with KnownPrefixedLengthUnparserMixin { + binaryDecimalVirtualPoint: Int +) extends IBM4690PackedDecimalBaseUnparser(e, binaryDecimalVirtualPoint) { - override def childProcessors: Vector[Processor] = Vector(prefixedLengthUnparser) override lazy val runtimeDependencies = Vector() override def getBitLength(s: ParseOrUnparseState): Int = { @@ -142,9 +123,4 @@ final class IBM4690PackedDecimalPrefixedLengthUnparser( val (byteLength, _) = DecimalUtils.ibm4690FromBigIntegerLength(absBigIntStr, 0, negative) byteLength * 8 } - - override def unparse(state: UState): Unit = { - unparsePrefixedLength(state) - super.unparse(state) - } } diff --git a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/PackedDecimalUnparsers.scala b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/PackedDecimalUnparsers.scala index ccad3a7a46..6464d94460 100644 --- a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/PackedDecimalUnparsers.scala +++ b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/PackedDecimalUnparsers.scala @@ -25,7 +25,6 @@ import org.apache.daffodil.lib.util.{ DecimalUtils, PackedSignCodes } import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.Evaluatable import org.apache.daffodil.runtime1.processors.ParseOrUnparseState -import org.apache.daffodil.runtime1.processors.Processor import org.apache.daffodil.runtime1.processors.parsers.HasKnownLengthInBits import org.apache.daffodil.runtime1.processors.parsers.HasRuntimeExplicitLength import org.apache.daffodil.runtime1.processors.unparsers._ @@ -67,15 +66,9 @@ final class PackedIntegerDelimitedUnparser( final class PackedIntegerPrefixedLengthUnparser( e: ElementRuntimeData, - override val prefixedLengthUnparser: Unparser, - override val prefixedLengthERD: ElementRuntimeData, - packedSignCodes: PackedSignCodes, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends PackedIntegerBaseUnparser(e, packedSignCodes) - with KnownPrefixedLengthUnparserMixin { + packedSignCodes: PackedSignCodes +) extends PackedIntegerBaseUnparser(e, packedSignCodes) { - override def childProcessors: Vector[Processor] = Vector(prefixedLengthUnparser) override lazy val runtimeDependencies = Vector() override def getBitLength(s: ParseOrUnparseState): Int = { @@ -84,11 +77,6 @@ final class PackedIntegerPrefixedLengthUnparser( val (byteLength, _) = DecimalUtils.packedFromBigIntegerLength(absBigIntStr, 0) byteLength * 8 } - - override def unparse(state: UState): Unit = { - unparsePrefixedLength(state) - super.unparse(state) - } } abstract class PackedDecimalBaseUnparser( @@ -132,16 +120,10 @@ final class PackedDecimalDelimitedUnparser( final class PackedDecimalPrefixedLengthUnparser( e: ElementRuntimeData, - override val prefixedLengthUnparser: Unparser, - override val prefixedLengthERD: ElementRuntimeData, binaryDecimalVirtualPoint: Int, - packedSignCodes: PackedSignCodes, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends PackedDecimalBaseUnparser(e, binaryDecimalVirtualPoint, packedSignCodes) - with KnownPrefixedLengthUnparserMixin { + packedSignCodes: PackedSignCodes +) extends PackedDecimalBaseUnparser(e, binaryDecimalVirtualPoint, packedSignCodes) { - override def childProcessors: Vector[Processor] = Vector(prefixedLengthUnparser) override lazy val runtimeDependencies = Vector() override def getBitLength(s: ParseOrUnparseState): Int = { @@ -151,9 +133,4 @@ final class PackedDecimalPrefixedLengthUnparser( byteLength * 8 } - override def unparse(state: UState): Unit = { - unparsePrefixedLength(state) - super.unparse(state) - } - } diff --git a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/SpecifiedLength2.scala b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/SpecifiedLength2.scala index 3dcebfa9d6..957110f4e4 100644 --- a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/SpecifiedLength2.scala +++ b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/SpecifiedLength2.scala @@ -931,11 +931,11 @@ class PrefixLengthSuspendableOperation( override protected def maybeKnownLengthInBits(ustate: UState): MaybeULong = MaybeULong(0L) override def test(ustate: UState): Boolean = { - elem.valueLength.maybeLengthInBits.isDefined + elem.contentLength.maybeLengthInBits.isDefined } override def continuation(state: UState): Unit = { - val len = elem.valueLength.maybeLengthInBits.isDefined + val len = elem.contentLength.maybeLengthInBits.isDefined assignPrefixLength(state, elem, plElem) } } diff --git a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/SpecifiedLengthUnparsers.scala b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/SpecifiedLengthUnparsers.scala index 321e738318..e3d3bf1635 100644 --- a/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/SpecifiedLengthUnparsers.scala +++ b/daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/unparsers/runtime1/SpecifiedLengthUnparsers.scala @@ -31,7 +31,6 @@ import org.apache.daffodil.runtime1.infoset.RetryableException import org.apache.daffodil.runtime1.processors.CharsetEv import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.Evaluatable -import org.apache.daffodil.runtime1.processors.ParseOrUnparseState import org.apache.daffodil.runtime1.processors.Success import org.apache.daffodil.runtime1.processors.UnparseTargetLengthInBitsEv import org.apache.daffodil.runtime1.processors.UnparseTargetLengthInCharactersEv @@ -285,81 +284,6 @@ final class SpecifiedLengthExplicitImplicitUnparser( } } -// TODO: implement the capture length unparsers as just using this trait? -trait CaptureUnparsingValueLength { - - def captureValueLengthStart(state: UState, elem: DIElement): Unit = { - val dos = state.dataOutputStream - if (dos.maybeAbsBitPos0b.isDefined) { - elem.valueLength.setAbsStartPos0bInBits(dos.maybeAbsBitPos0b.getULong) - } else { - elem.valueLength.setRelStartPos0bInBits(dos.relBitPos0b, dos) - } - } - - def captureValueLengthEnd(state: UState, elem: DIElement): Unit = { - val dos = state.dataOutputStream - if (dos.maybeAbsBitPos0b.isDefined) { - elem.valueLength.setAbsEndPos0bInBits(dos.maybeAbsBitPos0b.getULong) - } else { - elem.valueLength.setRelEndPos0bInBits(dos.relBitPos0b, dos) - } - } -} - -/** - * This trait is to be used with prefixed length unparsers where the length is - * known without needing to unparse the data. This means there is either a - * fixed length (like in the case of some binary numbers), or the length can be - * determined completly be inspecting the infoset data (like in the case of - * packed decimals). The length calculation performed in the getBitLength - * function, which returns the length of the data in bits. - */ -trait KnownPrefixedLengthUnparserMixin { - def prefixedLengthERD: ElementRuntimeData - def prefixedLengthUnparser: Unparser - def lengthUnits: LengthUnits - def getBitLength(s: ParseOrUnparseState): Int - def prefixedLengthAdjustmentInUnits: Long - - def unparsePrefixedLength(state: UState): Unit = { - val bits = getBitLength(state) - val lenInUnits = - if (lengthUnits == LengthUnits.Bytes) { - bits >> 3 - } else { - bits - } - val adjustedLenInUnits = lenInUnits + prefixedLengthAdjustmentInUnits - // Create a "detached" DIDocument with a single child element that the - // prefix length will be unparsed from. This creates a completely new - // infoset and unparses from that, so care is taken to ensure this infoset - // is only used for the prefix length unparsing and is removed afterwards - val plElement = Infoset.newDetachedElement(state, prefixedLengthERD).asInstanceOf[DISimple] - - plElement.setDataValue(java.lang.Integer.valueOf(adjustedLenInUnits.toInt)) - - // do checks on facets expressed on prefixLengthType - val optSTRD = plElement.erd.optSimpleTypeRuntimeData - if (optSTRD.isDefined) { - val strd = optSTRD.get - val check = strd.executeCheck(plElement) - if (check.isError) { - UnparseError( - One(state.schemaFileLocation), - One(state.currentLocation), - s"The calculated value of ${prefixedLengthERD.namedQName} ($adjustedLenInUnits) failed check due to ${check.errMsg}" - ) - } - } - - // unparse the prefixed length element - state.currentInfosetNodeStack.push(One(plElement)) - prefixedLengthUnparser.unparse1(state) - state.currentInfosetNodeStack.pop - } -} - /** * This trait is to be used with prefixed length unparsers where the length * must be calculated based on the value length of the data. This means the @@ -380,16 +304,16 @@ trait CalculatedPrefixedLengthUnparserMixin { */ def assignPrefixLength(state: UState, elem: DIElement, plElem: DISimple): Unit = { val lenInUnits = lengthUnits match { - case LengthUnits.Bits => elem.valueLength.lengthInBits - case LengthUnits.Bytes => elem.valueLength.lengthInBytes + case LengthUnits.Bits => elem.contentLength.lengthInBits + case LengthUnits.Bytes => elem.contentLength.lengthInBytes case LengthUnits.Characters => { val maybeFixedWidth = elem.erd.encInfo.getEncoderInfo(state).coder.bitsCharset.maybeFixedWidth val lengthInChars = if (maybeFixedWidth.isDefined) { val fixedWidth = maybeFixedWidth.get - Assert.invariant((elem.valueLength.lengthInBits % fixedWidth) == 0) // divisible - elem.valueLength.lengthInBits / fixedWidth + Assert.invariant((elem.contentLength.lengthInBits % fixedWidth) == 0) // divisible + elem.contentLength.lengthInBits / fixedWidth } else { // This is checked for statically, so should not get here. // $COVERAGE-OFF$ @@ -412,7 +336,7 @@ trait CalculatedPrefixedLengthUnparserMixin { UnparseError( One(state.schemaFileLocation), One(state.currentLocation), - s"The calculated value of ${elem.namedQName} ($adjustedLenInUnits) failed check due to ${check.errMsg}" + s"The calculated value of ${plElem.namedQName} ($adjustedLenInUnits) failed check due to ${check.errMsg}" ) } } @@ -427,7 +351,6 @@ class SpecifiedLengthPrefixedUnparser( override val lengthUnits: LengthUnits, override val prefixedLengthAdjustmentInUnits: Long ) extends CombinatorUnparser(erd) - with CaptureUnparsingValueLength with CalculatedPrefixedLengthUnparserMixin { override lazy val runtimeDependencies = Vector() @@ -450,13 +373,10 @@ class SpecifiedLengthPrefixedUnparser( prefixedLengthUnparser.unparse1(state) state.currentInfosetNodeStack.pop - // We now need to capture the length of the actual element val elem = state.currentInfosetNode.asInstanceOf[DIElement] - captureValueLengthStart(state, elem) eUnparser.unparse1(state) - captureValueLengthEnd(state, elem) - if (elem.valueLength.maybeLengthInBits.isDefined) { + if (elem.contentLength.maybeLengthInBits.isDefined) { // If we were able to immediately calculate the length of the element, // then just set it as the value of the detached element created above so // that when the prefixedLengthUnparser suspension resumes it can unparse @@ -465,7 +385,7 @@ class SpecifiedLengthPrefixedUnparser( } else { // The length was not able to be calculated, likely because there was a // suspension when unparsing the eUnparser. So let's create a new - // suspension with the only goal to retry until the valueLength of this + // suspension with the only goal to retry until the contentLength of this // element is determined. Once determined, it will set the value of the // prefix length element, ultimately allowing the prefix length element // suspension to resume and unparse the value diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetImpl.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetImpl.scala index 0ff990525d..8f452668b3 100644 --- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetImpl.scala +++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/infoset/InfosetImpl.scala @@ -733,6 +733,10 @@ sealed abstract class LengthState(ie: DIElement) { } def setAbsStartPos0bInBits(absPosInBits0b: ULong): Unit = { + Assert.invariant( + maybeStartPos0bInBits.isEmpty, + s"maybeStartPos0bInBits already has a value: $maybeStartPos0bInBits" + ) maybeStartPos0bInBits = MaybeULong(absPosInBits0b.longValue) maybeStartDataOutputStream = Nope } @@ -743,6 +747,10 @@ sealed abstract class LengthState(ie: DIElement) { } def setAbsEndPos0bInBits(absPosInBits0b: ULong): Unit = { + Assert.invariant( + maybeEndPos0bInBits.isEmpty, + s"maybeEndPos0bInBits already has a value: $maybeEndPos0bInBits" + ) maybeEndPos0bInBits = MaybeULong(absPosInBits0b.longValue) maybeEndDataOutputStream = Nope } diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/BCDParsers.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/BCDParsers.scala index 7c6311e100..631b09146a 100644 --- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/BCDParsers.scala +++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/BCDParsers.scala @@ -24,8 +24,6 @@ import org.apache.daffodil.lib.schema.annotation.props.gen.LengthUnits import org.apache.daffodil.lib.util.DecimalUtils import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.Evaluatable -import org.apache.daffodil.runtime1.processors.ParseOrUnparseState -import org.apache.daffodil.runtime1.processors.Processor class BCDDecimalKnownLengthParser( e: ElementRuntimeData, @@ -56,24 +54,13 @@ class BCDDecimalRuntimeLengthParser( class BCDDecimalPrefixedLengthParser( e: ElementRuntimeData, - override val prefixedLengthParser: Parser, - override val prefixedLengthERD: ElementRuntimeData, - binaryDecimalVirtualPoint: Int, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long + binaryDecimalVirtualPoint: Int ) extends PackedBinaryDecimalBaseParser(e, binaryDecimalVirtualPoint) - with PrefixedLengthParserMixin { + with PrefixedLengthParserMixin2 { override def toBigInteger(num: Array[Byte]): JBigInteger = DecimalUtils.bcdToBigInteger(num) override def toBigDecimal(num: Array[Byte], scale: Int): JBigDecimal = DecimalUtils.bcdToBigDecimal(num, scale) - - override def childProcessors: Vector[Processor] = Vector(prefixedLengthParser) - - override def getBitLength(state: ParseOrUnparseState): Int = { - getPrefixedLengthInBits(state.asInstanceOf[PState]).toInt - } - } class BCDIntegerRuntimeLengthParser( @@ -99,22 +86,11 @@ class BCDIntegerKnownLengthParser(e: ElementRuntimeData, val lengthInBits: Int) } -class BCDIntegerPrefixedLengthParser( - e: ElementRuntimeData, - override val prefixedLengthParser: Parser, - override val prefixedLengthERD: ElementRuntimeData, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends PackedBinaryIntegerBaseParser(e) - with PrefixedLengthParserMixin { +class BCDIntegerPrefixedLengthParser(e: ElementRuntimeData) + extends PackedBinaryIntegerBaseParser(e) + with PrefixedLengthParserMixin2 { override def toBigInteger(num: Array[Byte]): JBigInteger = DecimalUtils.bcdToBigInteger(num) override def toBigDecimal(num: Array[Byte], scale: Int): JBigDecimal = DecimalUtils.bcdToBigDecimal(num, scale) - - override def childProcessors: Vector[Processor] = Vector(prefixedLengthParser) - - override def getBitLength(state: ParseOrUnparseState): Int = { - getPrefixedLengthInBits(state.asInstanceOf[PState]).toInt - } } diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/IBM4690PackedDecimalParsers.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/IBM4690PackedDecimalParsers.scala index 36067c404f..4082c2865b 100644 --- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/IBM4690PackedDecimalParsers.scala +++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/IBM4690PackedDecimalParsers.scala @@ -24,8 +24,6 @@ import org.apache.daffodil.lib.schema.annotation.props.gen.LengthUnits import org.apache.daffodil.lib.util.DecimalUtils import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.Evaluatable -import org.apache.daffodil.runtime1.processors.ParseOrUnparseState -import org.apache.daffodil.runtime1.processors.Processor class IBM4690PackedDecimalKnownLengthParser( e: ElementRuntimeData, @@ -58,25 +56,15 @@ class IBM4690PackedDecimalRuntimeLengthParser( class IBM4690PackedDecimalPrefixedLengthParser( e: ElementRuntimeData, - override val prefixedLengthParser: Parser, - override val prefixedLengthERD: ElementRuntimeData, - binaryDecimalVirtualPoint: Int, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long + binaryDecimalVirtualPoint: Int ) extends PackedBinaryDecimalBaseParser(e, binaryDecimalVirtualPoint) - with PrefixedLengthParserMixin { + with PrefixedLengthParserMixin2 { override def toBigInteger(num: Array[Byte]): JBigInteger = DecimalUtils.ibm4690ToBigInteger(num) override def toBigDecimal(num: Array[Byte], scale: Int): JBigDecimal = DecimalUtils.ibm4690ToBigDecimal(num, scale) - override def childProcessors: Vector[Processor] = Vector(prefixedLengthParser) - - override def getBitLength(state: ParseOrUnparseState): Int = { - getPrefixedLengthInBits(state.asInstanceOf[PState]).toInt - } - } class IBM4690PackedIntegerRuntimeLengthParser( @@ -108,24 +96,13 @@ class IBM4690PackedIntegerKnownLengthParser( } -class IBM4690PackedIntegerPrefixedLengthParser( - e: ElementRuntimeData, - override val prefixedLengthParser: Parser, - override val prefixedLengthERD: ElementRuntimeData, - signed: Boolean, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends PackedBinaryIntegerBaseParser(e, signed) - with PrefixedLengthParserMixin { +class IBM4690PackedIntegerPrefixedLengthParser(e: ElementRuntimeData, signed: Boolean) + extends PackedBinaryIntegerBaseParser(e, signed) + with PrefixedLengthParserMixin2 { override def toBigInteger(num: Array[Byte]): JBigInteger = DecimalUtils.ibm4690ToBigInteger(num) override def toBigDecimal(num: Array[Byte], scale: Int): JBigDecimal = DecimalUtils.ibm4690ToBigDecimal(num, scale) - override def childProcessors: Vector[Processor] = Vector(prefixedLengthParser) - - override def getBitLength(state: ParseOrUnparseState): Int = { - getPrefixedLengthInBits(state.asInstanceOf[PState]).toInt - } } diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/PackedDecimalParsers.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/PackedDecimalParsers.scala index 248322f3e1..c860bdddc3 100644 --- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/PackedDecimalParsers.scala +++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/PackedDecimalParsers.scala @@ -24,8 +24,6 @@ import org.apache.daffodil.lib.schema.annotation.props.gen.LengthUnits import org.apache.daffodil.lib.util.{ DecimalUtils, PackedSignCodes } import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.Evaluatable -import org.apache.daffodil.runtime1.processors.ParseOrUnparseState -import org.apache.daffodil.runtime1.processors.Processor class PackedDecimalKnownLengthParser( e: ElementRuntimeData, @@ -60,26 +58,15 @@ class PackedDecimalRuntimeLengthParser( class PackedDecimalPrefixedLengthParser( e: ElementRuntimeData, - override val prefixedLengthParser: Parser, - override val prefixedLengthERD: ElementRuntimeData, binaryDecimalVirtualPoint: Int, - packedSignCodes: PackedSignCodes, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long + packedSignCodes: PackedSignCodes ) extends PackedBinaryDecimalBaseParser(e, binaryDecimalVirtualPoint) - with PrefixedLengthParserMixin { + with PrefixedLengthParserMixin2 { override def toBigInteger(num: Array[Byte]): JBigInteger = DecimalUtils.packedToBigInteger(num, packedSignCodes) override def toBigDecimal(num: Array[Byte], scale: Int): JBigDecimal = DecimalUtils.packedToBigDecimal(num, scale, packedSignCodes) - - override def childProcessors: Vector[Processor] = Vector(prefixedLengthParser) - - override def getBitLength(state: ParseOrUnparseState): Int = { - getPrefixedLengthInBits(state.asInstanceOf[PState]).toInt - } - } class PackedIntegerRuntimeLengthParser( @@ -115,23 +102,13 @@ class PackedIntegerKnownLengthParser( class PackedIntegerPrefixedLengthParser( e: ElementRuntimeData, - override val prefixedLengthParser: Parser, - override val prefixedLengthERD: ElementRuntimeData, signed: Boolean, - packedSignCodes: PackedSignCodes, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long + packedSignCodes: PackedSignCodes ) extends PackedBinaryIntegerBaseParser(e, signed) - with PrefixedLengthParserMixin { + with PrefixedLengthParserMixin2 { override def toBigInteger(num: Array[Byte]): JBigInteger = DecimalUtils.packedToBigInteger(num, packedSignCodes) override def toBigDecimal(num: Array[Byte], scale: Int): JBigDecimal = DecimalUtils.packedToBigDecimal(num, scale, packedSignCodes) - - override def childProcessors: Vector[Processor] = Vector(prefixedLengthParser) - - override def getBitLength(state: ParseOrUnparseState): Int = { - getPrefixedLengthInBits(state.asInstanceOf[PState]).toInt - } } diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryBooleanParsers.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryBooleanParsers.scala index ee7e85ba3b..430330512a 100644 --- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryBooleanParsers.scala +++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryBooleanParsers.scala @@ -26,7 +26,6 @@ import org.apache.daffodil.lib.util.MaybeULong import org.apache.daffodil.lib.util.Numbers import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.Evaluatable -import org.apache.daffodil.runtime1.processors.Processor import passera.unsigned.ULong @@ -108,19 +107,15 @@ class BinaryBooleanParser( class BinaryBooleanPrefixedLengthParser( override val context: ElementRuntimeData, - override val prefixedLengthParser: Parser, - override val prefixedLengthERD: ElementRuntimeData, binaryBooleanTrueRep: MaybeULong, binaryBooleanFalseRep: ULong, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long + lengthUnits: LengthUnits ) extends BinaryBooleanParserBase(binaryBooleanTrueRep, binaryBooleanFalseRep, lengthUnits) - with PrefixedLengthParserMixin { + with PrefixedLengthParserMixin2 { - override def childProcessors: Vector[Processor] = Vector(prefixedLengthParser) override val runtimeDependencies = Vector() override def getBitLength(state: PState): Int = { - getPrefixedLengthInBits(state).toInt + getLengthInBits(state).toInt } } diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryNumberParsers.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryNumberParsers.scala index a373be2fbc..8009579258 100644 --- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryNumberParsers.scala +++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryNumberParsers.scala @@ -27,7 +27,6 @@ import org.apache.daffodil.runtime1.dpath.NodeInfo import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.Evaluatable import org.apache.daffodil.runtime1.processors.ParseOrUnparseState -import org.apache.daffodil.runtime1.processors.Processor class BinaryFloatParser(override val context: ElementRuntimeData) extends PrimParser { override lazy val runtimeDependencies = Vector() @@ -80,21 +79,10 @@ class BinaryDecimalRuntimeLengthParser( class BinaryDecimalPrefixedLengthParser( e: ElementRuntimeData, - override val prefixedLengthParser: Parser, - override val prefixedLengthERD: ElementRuntimeData, signed: YesNo, - binaryDecimalVirtualPoint: Int, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long + binaryDecimalVirtualPoint: Int ) extends BinaryDecimalParserBase(e, signed, binaryDecimalVirtualPoint) - with PrefixedLengthParserMixin { - - override def childProcessors: Vector[Processor] = Vector(prefixedLengthParser) - - override def getBitLength(state: ParseOrUnparseState): Int = { - getPrefixedLengthInBits(state.asInstanceOf[PState]).toInt - } -} + with PrefixedLengthParserMixin2 abstract class BinaryDecimalParserBase( override val context: ElementRuntimeData, @@ -137,22 +125,9 @@ class BinaryIntegerKnownLengthParser( ) extends BinaryIntegerBaseParser(e, signed) with HasKnownLengthInBits {} -class BinaryIntegerPrefixedLengthParser( - e: ElementRuntimeData, - override val prefixedLengthParser: Parser, - override val prefixedLengthERD: ElementRuntimeData, - signed: Boolean, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends BinaryIntegerBaseParser(e, signed) - with PrefixedLengthParserMixin { - - override def childProcessors: Vector[Processor] = Vector(prefixedLengthParser) - - override def getBitLength(state: ParseOrUnparseState): Int = { - getPrefixedLengthInBits(state.asInstanceOf[PState]).toInt - } -} +class BinaryIntegerPrefixedLengthParser(e: ElementRuntimeData, signed: Boolean) + extends BinaryIntegerBaseParser(e, signed) + with PrefixedLengthParserMixin2 abstract class BinaryIntegerBaseParser( override val context: ElementRuntimeData, @@ -169,13 +144,15 @@ abstract class BinaryIntegerBaseParser( if (nBits == 0) return // zero length is used for outputValueCalc often. if (primNumeric.width.isDefined) { val width = primNumeric.width.get - if (nBits > width) + if (nBits > width) { PE( start, "Number of bits %d out of range, must be between 1 and %d bits.", nBits, width ) + return + } } val dis = start.dataInputStream if (!dis.isDefinedForLength(nBits)) { diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryNumberTraits.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryNumberTraits.scala index 29317a2952..8ef23965d5 100644 --- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryNumberTraits.scala +++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryNumberTraits.scala @@ -165,3 +165,21 @@ trait PrefixedLengthParserMixin { } } } + +/** + * This mixin doesn't require parsing the prefix length element and just uses + * the state's bitLimit and position to get the bitLength instead + */ +trait PrefixedLengthParserMixin2 { + + def getBitLength(s: ParseOrUnparseState): Int = { + val pState = s.asInstanceOf[PState] + val len = getLengthInBits(pState) + len.toInt + } + + def getLengthInBits(pstate: PState): Long = { + val len = pstate.bitLimit0b.get - pstate.bitPos0b + len + } +} diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/HexBinaryLengthParsers.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/HexBinaryLengthParsers.scala index 5f00208a4b..ba66549cdf 100644 --- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/HexBinaryLengthParsers.scala +++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/HexBinaryLengthParsers.scala @@ -19,10 +19,8 @@ package org.apache.daffodil.runtime1.processors.parsers import java.nio.ByteBuffer -import org.apache.daffodil.lib.schema.annotation.props.gen.LengthUnits import org.apache.daffodil.runtime1.processors.ElementRuntimeData import org.apache.daffodil.runtime1.processors.LengthInBitsEv -import org.apache.daffodil.runtime1.processors.Processor sealed abstract class HexBinaryLengthParser(override val context: ElementRuntimeData) extends PrimParser @@ -95,19 +93,9 @@ final class HexBinaryEndOfBitLimitParser(erd: ElementRuntimeData) } } -final class HexBinaryLengthPrefixedParser( - erd: ElementRuntimeData, - override val prefixedLengthParser: Parser, - override val prefixedLengthERD: ElementRuntimeData, - override val lengthUnits: LengthUnits, - override val prefixedLengthAdjustmentInUnits: Long -) extends HexBinaryLengthParser(erd) - with PrefixedLengthParserMixin { +final class HexBinaryLengthPrefixedParser(erd: ElementRuntimeData) + extends HexBinaryLengthParser(erd) + with PrefixedLengthParserMixin2 { - override def childProcessors: Vector[Processor] = Vector(prefixedLengthParser) override val runtimeDependencies = Vector() - - override def getLengthInBits(pstate: PState): Long = { - getPrefixedLengthInBits(pstate) - } } diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SpecifiedLengthParsers.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SpecifiedLengthParsers.scala index 837a6461f7..42e42f10e5 100644 --- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SpecifiedLengthParsers.scala +++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/SpecifiedLengthParsers.scala @@ -86,7 +86,9 @@ sealed abstract class SpecifiedLengthParserBase(eParser: Parser, erd: RuntimeDat val finalEndPos0b = startingBitPos0b + nBits // we want to capture the length before we do any skipping - if (pState.infoset.isComplex) + // value length of simple types is captured by the eParser if needed + // the SpecifiedLengthParserBase is extended by SpecifiedLengthChoiceParser which should not have its valueLength captured here + if (pState.infoset.isComplex && !erd.isInstanceOf[ChoiceRuntimeData]) captureValueLength(pState, ULong(startingBitPos0b), ULong(dis.bitPos0b)) Assert.invariant(dis eq pState.dataInputStream) diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/section12/lengthKind/PrefixedTests.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/section12/lengthKind/PrefixedTests.tdml index 630c7455b6..67f4fb7f57 100644 --- a/daffodil-test/src/test/resources/org/apache/daffodil/section12/lengthKind/PrefixedTests.tdml +++ b/daffodil-test/src/test/resources/org/apache/daffodil/section12/lengthKind/PrefixedTests.tdml @@ -24,7 +24,7 @@ xmlns:ex="http://example.com" xmlns:tns="http://example.com" xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions" - defaultRoundTrip="onePass" xmlns:x="http://www.ogf.org/dfdl/dfdl-1.0/"> + defaultRoundTrip="onePass"> @@ -2347,6 +2347,28 @@ + + + + + + + + + + + + + + + + + + + 00 00 00 0B + ABC + + + + + ABC + 3 + + + + + @@ -2619,7 +2657,7 @@ + ignoreUnexpectedWarnings="false"> 08 ff diff --git a/daffodil-test/src/test/scala/org/apache/daffodil/section12/lengthKind/TestLengthKindPrefixed.scala b/daffodil-test/src/test/scala/org/apache/daffodil/section12/lengthKind/TestLengthKindPrefixed.scala index 01acb2f908..6cb1b4e0e0 100644 --- a/daffodil-test/src/test/scala/org/apache/daffodil/section12/lengthKind/TestLengthKindPrefixed.scala +++ b/daffodil-test/src/test/scala/org/apache/daffodil/section12/lengthKind/TestLengthKindPrefixed.scala @@ -307,6 +307,11 @@ class TestLengthKindPrefixed { runner.runOneTest("pl_simpleValueLengthBytes_2") } + // DAFFODIL-2948 + @Test def test_pl_simpleValueLengthBytes_3() = { + runner.runOneTest("pl_simpleValueLengthBytes_3") + } + @Test def test_pl_simpleContentLengthCharacters_1() = { runner.runOneTest("pl_simpleContentLengthCharacters_1") }