mbeckerle commented on a change in pull request #214: Sequences and Separators 
Refactoring and Rewrite
URL: https://github.com/apache/incubator-daffodil/pull/214#discussion_r285710834
 
 

 ##########
 File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/Term.scala
 ##########
 @@ -434,51 +454,105 @@ trait Term
    */
   def isVariableOccurrences: Boolean = false
 
+  /**
+   * True when a term's immediately enclosing model group is a Sequence.
+   */
+  final lazy val isSequenceChild: Boolean =
+    immediatelyEnclosingModelGroup.map { _.isInstanceOf[SequenceTermBase] 
}.getOrElse(false)
+
   /**
    * The concept of potentially trailing is defined in the DFDL specification.
    *
-   * It means that the term could have instances that are the last thing in 
the sequence group
-   * and that are potentially also not present, so the issue of extra 
separators being present/absent for
-   * instances of the term is relevant.
+   * This concept applies to terms that are direct children of a sequence only.
+   *
+   * It is true for terms that may be absent from the representation, but 
furthermore, may be last
+   * in a sequence, so that the notion of whether they are trailing, and so 
their separator may not be
+   * present, is a relevant issue.
+   *
+   * If an element is an array, and has some required instances, then it is 
not potentially trailing, as some
+   * instances will have to appear, with separators.
+   *
+   * This concept applies only to elements and model groups that have 
representation in the data stream.
+   *
+   * Previously there was a misguided notion that since only DFDL elements can 
have minOccurs/maxOccurs
+   * that this notion of potentially trailing didn't apply to model groups. 
(Sequences and Choices, the other
+   * kind of Term). But this is not the case.
+   *
 
 Review comment:
   Yes, this is not backward compatible, and in fact some DFDL schemas don't 
work now... or work but produce slightly different infosets, so their tests 
break - typically things change around when empty elements have to appear or 
not in the infoset. 
   
   
   But the changes here are bug fixes, and the old behavior is not correct, so 
existing schemas were depending on bug behavior. I think it only is going to 
actually impact delimited text data.  
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to