olabusayoT commented on code in PR #1652:
URL: https://github.com/apache/daffodil/pull/1652#discussion_r3357067483


##########
daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/TermGrammarMixin.scala:
##########
@@ -84,4 +96,181 @@ trait TermGrammarMixin extends AlignedMixin with 
BitOrderMixin with TermRuntime1
     MandatoryTextAlignment(this, knownEncodingAlignmentInBits, true)
   }
 
+  def myEffectiveLengthUnits(optLastNonEOPLU: Option[LengthUnits]): 
Option[LengthUnits] = {
+    val elu = this match {
+      case e: ElementBase =>
+        e.lengthKind match {
+          case LengthKind.EndOfParent => optLastNonEOPLU
+          case LengthKind.Explicit | LengthKind.Prefixed => Some(e.lengthUnits)
+          case LengthKind.Pattern => Some(LengthUnits.Characters)
+          case _ => None
+        }
+      case c: ChoiceTermBase if c.choiceLengthKind == 
ChoiceLengthKind.Explicit =>
+        Some(LengthUnits.Bytes)
+      // the spec doesn't actually account for this case, but logically it 
makes
+      // sense that ELU of a sequence is the ELU of its parent that 
technically is the
+      // last non-EndOfParent ELU.
+      case s: SequenceTermBase => optLastNonEOPLU
+      case _ => None

Review Comment:
   I actually ended up removing the option and just propagating lastNonEOPELU 
for the failure cases since they SDE anyway, the values will not get used. I'll 
update the _ to be more specific tho



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to