You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2018/07/20 14:04:33 UTC

[GitHub] mbeckerle commented on a change in pull request #74: Daffodil trailing sep

mbeckerle commented on a change in pull request #74: Daffodil trailing sep
URL: https://github.com/apache/incubator-daffodil/pull/74#discussion_r204055199
 
 

 ##########
 File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/Term.scala
 ##########
 @@ -359,6 +360,25 @@ trait Term
   def isKnownRequiredElement = false
   def hasKnownRequiredSyntax = false
 
+  def hasPotentiallyTrailingInstances: Boolean = false
+  final def isPotentiallyTrailing = LV('isPotentiallyTrailing) {
+    if (!isRequired) {
+      val es = nearestEnclosingSequence
+      val res = es match {
+        case None => true
+        case Some(s) => {
+          val allRequired = s.groupMembers.filter(_.isRequired)
+          val lastDeclaredRequired = allRequired.last
+          if (s.groupMembers.indexOf(lastDeclaredRequired) < s.groupMembers.indexOf(this)) true
+          else false
+        }
+      }
+      res
+      // Since we can't determine at compile time, return false so that we can continue processing.
+      // Runtime checks will make final determination.
 
 Review comment:
   Agree, I think the comment is misworded, or just wrong or spurious. We can't determine everything about whether something is actually trailing, but we can determine this isLastDeclaredRequiredElementOfSequence.
   
   Also I think all these complex attribute LVs of the DSOM objects need scaladoc, as you point out in other comments, they are potentially duplicated logic, or the subtle distinction between them is not apparent from their names. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services