stevedlawrence 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_r242156399
##########
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:
This is some odd indenting from eclipse. I wonder if maybe we should use
scalafmt as the official indententation standard for daffodil? It has an sbt
plugin so contributors could just run the before a code review to fix up any
issues. And it would be easy to add a check to TravisCI to ensure we maintain
the standard formatting. We would probably need to have a small code freeze and
reindent everything according tothe standard, but that's not too big of a deal,
and should really just be a one time thing once the standard is applied and
enforced.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services