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

 ##########
 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:
   I agree that we should embed a tool like that. 
   
   We need a tool for XML indenting as well. Those files are full of tabs now, 
and CRLFs are starting to creep in here and there also. 
   
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to