stevedlawrence commented on a change in pull request #570:
URL: https://github.com/apache/daffodil/pull/570#discussion_r635260214
##########
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) {
Review comment:
This only checks for constant escape characters and constant
terminators/separators. And it only checks those defined on the same element.
Do we also need to check all in-scope terminating markup? Which really can only
easilyl be checked at runtime? Not sure how much overhead that might have
though?
##########
File path:
daffodil-test/src/test/scala/org/apache/daffodil/section07/escapeScheme/TestEscapeScheme.scala
##########
@@ -104,43 +104,10 @@ class TestEscapeScheme {
@Test def test_scenario2_14_req_term(): Unit = {
runner2.runOneTest("scenario2_14_req_term") }
@Test def test_scenario3_1(): Unit = { runner2.runOneTest("scenario3_1") }
- @Test def test_scenario3_2(): Unit = { runner2.runOneTest("scenario3_2") }
- @Test def test_scenario3_3(): Unit = { runner2.runOneTest("scenario3_3") }
- @Test def test_scenario3_4(): Unit = { runner2.runOneTest("scenario3_4") }
- @Test def test_scenario3_5(): Unit = { runner2.runOneTest("scenario3_5") }
- @Test def test_scenario3_6(): Unit = { runner2.runOneTest("scenario3_6") }
- @Test def test_scenario3_7(): Unit = { runner2.runOneTest("scenario3_7") }
- @Test def test_scenario3_8(): Unit = { runner2.runOneTest("scenario3_8") }
- @Test def test_scenario3_9(): Unit = { runner2.runOneTest("scenario3_9") }
- @Test def test_scenario3_10(): Unit = { runner2.runOneTest("scenario3_10") }
- @Test def test_scenario3_10_postfix(): Unit = {
runner2.runOneTest("scenario3_10_postfix") }
- @Test def test_scenario3_11(): Unit = { runner2.runOneTest("scenario3_11") }
- //DFDL-961
- //@Test def test_scenario3_11_postfix() {
runner2.runOneTest("scenario3_11_postfix") }
- @Test def test_scenario3_12(): Unit = { runner2.runOneTest("scenario3_12") }
- @Test def test_scenario3_12_req_term(): Unit = {
runner2.runOneTest("scenario3_12_req_term") }
- @Test def test_scenario3_13(): Unit = { runner2.runOneTest("scenario3_13") }
- @Test def test_scenario3_13_postfix(): Unit = {
runner2.runOneTest("scenario3_13_postfix") }
- @Test def test_scenario3_14(): Unit = { runner2.runOneTest("scenario3_14") }
- @Test def test_scenario3_14_req_term(): Unit = {
runner2.runOneTest("scenario3_14_req_term") }
- @Test def test_scenario4_1(): Unit = { runner2.runOneTest("scenario4_1") }
- @Test def test_scenario4_2(): Unit = { runner2.runOneTest("scenario4_2") }
- @Test def test_scenario4_3(): Unit = { runner2.runOneTest("scenario4_3") }
- @Test def test_scenario4_4(): Unit = { runner2.runOneTest("scenario4_4") }
- @Test def test_scenario4_5(): Unit = { runner2.runOneTest("scenario4_5") }
- @Test def test_scenario4_6(): Unit = { runner2.runOneTest("scenario4_6") }
- @Test def test_scenario4_7(): Unit = { runner2.runOneTest("scenario4_7") }
@Test def test_scenario4_7_req_term(): Unit = {
runner2.runOneTest("scenario4_7_req_term") }
- @Test def test_scenario4_8(): Unit = { runner2.runOneTest("scenario4_8") }
- @Test def test_scenario4_8_postfix(): Unit = {
runner2.runOneTest("scenario4_8_postfix") }
- @Test def test_scenario4_9(): Unit = { runner2.runOneTest("scenario4_9") }
@Test def test_scenario4_9_req_term(): Unit = {
runner2.runOneTest("scenario4_9_req_term") }
- @Test def test_scenario4_10(): Unit = { runner2.runOneTest("scenario4_10") }
@Test def test_scenario4_10_req_term(): Unit = {
runner2.runOneTest("scenario4_10_req_term") }
- @Test def test_scenario4_11(): Unit = { runner2.runOneTest("scenario4_11") }
- @Test def test_scenario4_11_postfix(): Unit = {
runner2.runOneTest("scenario4_11_postfix") }
- @Test def test_scenario4_12(): Unit = { runner2.runOneTest("scenario4_12") }
@Test def test_scenario4_12_req_term(): Unit = {
runner2.runOneTest("scenario4_12_req_term") }
Review comment:
Have you tested against the a regression suite to make sure this doesn't
break anything? I doubt any schemas run into this issue, but we supported it
before so I guess it's possible?
##########
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:
Why don't we also check EEC? Does that not have the same restriction?
--
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:
[email protected]