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


##########
daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/AlignedMixin.scala:
##########
@@ -228,29 +235,161 @@ trait AlignedMixin extends GrammarMixin { self: Term =>
       }
     }.value
 
+  private lazy val separatorPrefixMTAApprox =
+    this.optLexicalParent match {
+      case Some(s: SequenceTermBase) if s.hasSeparator =>
+        import SeparatorPosition.*
+        s.separatorPosition match {
+          case Prefix | Infix => 
LengthMultipleOf(s.knownEncodingAlignmentInBits)

Review Comment:
   Definitely. The naming could definitely be improved.
   
   Adding more variables might also be helpful. This document has great 
diagrams of all the different parts that are considered in our alignment
   
   https://daffodil.apache.org/dev/design-notes/term-sharing-in-schema-compiler/
   
   Some of our current variables kindof mush multiple boxes together which can 
make it difficult to tease apart what's going on and how well we actually match 
the document.
   
   It might makes sense to have a variable that calculates the approximate 
start of every one of the boxes with matching names (e.g. 
allignFilleApproximateStart, initiatorMTAApproximateStart),. It adds more 
variables, but might make things more clear.
   
   And that might simplify other logic that tries to statically compile out 
different grams. For example, the gram guards can become something like:
   
   ```scala
   val needsAlignFillGram = alignFillApproxStart % alignment != 0
   
   val needsInitiatorMTAGram = initiatorMTAApproxStart % 
initiator.encoding.mandatoryTextAlignment != 0
   ```
   
   



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