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 2019/01/04 19:39:23 UTC

[GitHub] jadams-tresys commented on a change in pull request #158: Daffodil 1080 sequences and separators - preliminary review

jadams-tresys commented on a change in pull request #158: Daffodil 1080 sequences and separators - preliminary review
URL: https://github.com/apache/incubator-daffodil/pull/158#discussion_r245399881
 
 

 ##########
 File path: daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/SequenceChild.scala
 ##########
 @@ -173,21 +173,33 @@ abstract class SequenceChild(
 class ScalarOrderedSequenceChild(sq: SequenceTermBase, term: Term, groupIndex: Int)
   extends SequenceChild(sq, term, groupIndex) {
 
-  def sequenceChildParser: SequenceChildParser = sq.hasSeparator match {
-    case true => new ScalarOrderedSeparatedSequenceChildParser(
-      childParser, srd, trd, sepParser, sq.separatorPosition, sq.separatorSuppressionPolicy)
-    case false => new ScalarOrderedUnseparatedSequenceChildParser(childParser, srd, trd)
+  lazy val sequenceChildParser: SequenceChildParser = {
+    val res =
+      (sq.hasSeparator, term.isPotentiallyTrailing) match {
+        case (true, false) => new ScalarOrderedSeparatedSequenceChildParser(
+        childParser, srd, trd, sepParser, sq.separatorPosition, sq.separatorSuppressionPolicy)
+        case (true, true) => new PotentiallyTrailingGroupSeparatedSequenceChildParser(
+        childParser, srd, mrd, sepParser, sq.separatorPosition, sq.separatorSuppressionPolicy)
+        case (false, _) => new ScalarOrderedUnseparatedSequenceChildParser(childParser, srd, trd)
+      }
+    res
   }
-  def sequenceChildUnparser: SequenceChildUnparser = sq.hasSeparator match {
-    case true => new ScalarOrderedSeparatedSequenceChildUnparser(
-      childUnparser, srd, trd, sepUnparser, sq.separatorPosition, sq.separatorSuppressionPolicy,
-      this.separatorSuppressionMode)
-    case false => new ScalarOrderedUnseparatedSequenceChildUnparser(childUnparser, srd, trd)
+  lazy val sequenceChildUnparser: SequenceChildUnparser = {
+    val res =
+      (sq.hasSeparator, term.isPotentiallyTrailing) match {
+        case (true, false) => new ScalarOrderedSeparatedSequenceChildUnparser(
+        childUnparser, srd, trd, sepUnparser, sq.separatorPosition, sq.separatorSuppressionPolicy,
+          this.separatorSuppressionMode)
 
 Review comment:
   For XML indenting we can use xmllint:
   xmllint --c14n     -> reorder all properties/attributes alphabetically
   xmllint --format   -> add new lines and indentation back in
   
   For some reason running xmllint with both options seems to ignore the --format option, so it seems like it has to be a 2 step process.  I used this process to generate an appropriate diff for a file that by virtue of being touched by XMLSpy had every line changed.

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