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


##########
daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ElementBaseGrammarMixin.scala:
##########
@@ -1341,18 +1451,29 @@ trait ElementBaseGrammarMixin
     // non-explicit lengthKind
     val body = bodyArg
 
+    val eopSimpleTypeElementThatNeedsBitLimit =
+      (isSimpleType && lengthKind == LengthKind.EndOfParent)
+        && !this.isInstanceOf[Root]

Review Comment:
   > So for root elements there is nothing to set the bitlimit for it, so it 
needs the SpecifiedLengthEndOfParent wrapper so it can calculate itself (via 
endOfDataPosition).
   
   I'm not sure I understand what makes root special. You said it needs to 
calculate itself, but if the root element is hexBinary or packed decimal we 
don't need that. The hexBinary or packed decimal parsers do handle calculating 
their length. I thought strings, nillables, and complex types need always need 
SpecifiedLengthEndOfParentParser regardless if they are root or not. And 
similarly, hexbinary and packed decimal never need 
SpecifiedLengthEndOfParentParser, regardless if they are root or not. It's 
there's a subtley here where that isn't always the case i think this needs a 
comment describing why.
   
   > Wondering if I ought to decompose EndOfParentParser so it doesn't do both 
things, and instead only works for things that expect something else to set the 
parent. Then create something else to wrap root simpleType root elements like 
what is done for hexbinary? Thoughts?
   
   I think that adds complications, because the things need to know if they are 
inside an EOP element or not. ANd it's not always possible to know if that's 
case because we can only know lexical parents. I think the current approach of 
having EOP parser handle both bitlimit and EOD cases makes sense.



-- 
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