You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by GitBox <gi...@apache.org> on 2021/05/19 14:14:34 UTC
[GitHub] [daffodil] jadams-tresys commented on a change in pull request #570: Add restrictions to delimiters for escapeCharacters
jadams-tresys commented on a change in pull request #570:
URL: https://github.com/apache/daffodil/pull/570#discussion_r635280579
##########
File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/RuntimePropertyMixins.scala
##########
@@ -654,6 +655,36 @@ trait SequenceRuntimeValuedPropertiesMixin
}
}
+ def checkDelimiterEscapeConflict(childTerm: Term): Unit = {
+ if (childTerm.optionEscapeScheme.isDefined &&
+ (childTerm.optionEscapeScheme.get.escapeKind == EscapeKind.EscapeCharacter) &&
+ (hasTerminator || hasSeparator)) {
+ val ecEv = childTerm.optionEscapeScheme.get.escapeCharacterEv
+ if (ecEv.isConstant) {
+ val ec = ecEv.constValue
+ var delims = Set[String]()
+
+ val termEv = this.terminatorParseEv
+ if (termEv.isConstant)
+ delims = delims ++ termEv.constValue.map { _.lookingFor }
+
+ val sepEv = this.separatorParseEv
+ if (sepEv.isConstant)
+ delims = delims ++ sepEv.constValue.map { _.lookingFor }
+
+ if (delims.exists { _.startsWith(ec) } )
+ SDE("The dfdl:terminator and dfdl:separator may not begin with the dfdl:escapeCharacter: '%s'.", ec)
+
+ /*val maybeEecEv = childTerm.optionEscapeScheme.get.optionEscapeEscapeCharacterEv
+ if (maybeEecEv.isDefined && maybeEecEv.get.isConstant) {
+ val eec = maybeEecEv.get.constValue
+ if (delims.exists { _.startsWith(eec) } )
+ SDE("The dfdl:terminator and dfdl:separator may not begin with the dfdl:escapeEscapeCharacter: '%s'.", eec)
Review comment:
I wasn't sure, which is why I had left this commented out. I'm not sure how IBM behaves for this case. I meant to mention that when I pushed it up, but forgot.
--
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org