olabusayoT commented on code in PR #1613:
URL: https://github.com/apache/daffodil/pull/1613#discussion_r2728496009
##########
daffodil-core/src/main/scala/org/apache/daffodil/core/dsom/SequenceGroup.scala:
##########
@@ -160,6 +162,36 @@ abstract class SequenceGroupTermBase(xml: Node,
lexicalParent: SchemaComponent,
}
}.value
+ lazy val checkValidityOccursCountKind: Unit = {
+ val validChildren: Seq[ElementBase] =
+ groupMembers
+ .filter { m => m.isInstanceOf[LocalElementDecl] ||
m.isInstanceOf[ElementRef] }
+ .map(_.asInstanceOf[ElementBase])
+
+ val invalidChild = validChildren.find(e => {
+ if (hasSeparator) {
+ e.occursCountKind match {
+ case Parsed =>
+ separatorSuppressionPolicy match {
+ case SeparatorSuppressionPolicy.AnyEmpty => false
+ case _ => true
+ }
+ case _ => false
+ }
+ } else {
+ false
+ }
+ })
+
+ if (invalidChild.isDefined) {
+ invalidChild.get.SDW(
+ WarnID.DiscouragedOCKParsedWithoutSSPAnyEmpty,
+ "Member of a sequence with dfdl:occursCountKind='parsed' must have
dfdl:separatorSuppressionPolicy='anyEmpty'. " +
+ "This may be changed to an error in a future version of Daffodil."
Review Comment:
We have the NumSeq_02 test with the description: Schema definition error for
occursCountKind 'parsed' with separatorPolicy 'required' (or
separatorSuppressionPolicy 'never').
that expects an empty error, but it actually returns a left over data error.
As far as the code, it looks like if it is Parsed, it assumes NonPositional,
it doesn't care about ssp unless OCK==implicit
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]