This is an automated email from the ASF dual-hosted git repository.

olabusayo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil.git


The following commit(s) were added to refs/heads/main by this push:
     new 67053f9fc Add EVDP SDW if EVDP is not both
67053f9fc is described below

commit 67053f9fc3ab0e1d778829caceb7ef142c1ba00e
Author: olabusayoT <[email protected]>
AuthorDate: Thu Oct 16 13:52:32 2025 -0400

    Add EVDP SDW if EVDP is not both
    
    - Introduced new `emptyValueDelimiterPolicyWarning` enumeration in 
`dafext.xsd`.
    - Implemented related validation logic in `ElementBaseGrammarMixin`.
    - Added test cases to cover new behavior for 
`dfdl:emptyValueDelimiterPolicy`.
    
    DAFFODIL-2205
---
 .../core/grammar/ElementBaseGrammarMixin.scala     | 14 +++++
 .../resources/org/apache/daffodil/xsd/dafext.xsd   |  1 +
 .../org/apache/daffodil/usertests/SepTests.tdml    | 71 ++++++++++++++++++++++
 .../apache/daffodil/usertests/TestSepTests.scala   |  5 ++
 4 files changed, 91 insertions(+)

diff --git 
a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ElementBaseGrammarMixin.scala
 
b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ElementBaseGrammarMixin.scala
index 48ee0a08b..3a33fdfb0 100644
--- 
a/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ElementBaseGrammarMixin.scala
+++ 
b/daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ElementBaseGrammarMixin.scala
@@ -51,6 +51,7 @@ trait ElementBaseGrammarMixin
   with ElementBaseRuntime1Mixin { self: ElementBase =>
 
   requiredEvaluationsIfActivated(checkPrefixedLengthElementDecl)
+  requiredEvaluationsIfActivated(checkDelimitedLengthEVDP)
 
   private val context = this
 
@@ -81,6 +82,19 @@ trait ElementBaseGrammarMixin
     }
   }
 
+  final lazy val checkDelimitedLengthEVDP: Unit = {
+    if (
+      (hasInitiator || hasTerminator)
+      && emptyValueDelimiterPolicy != EmptyValueDelimiterPolicy.Both
+    ) {
+      SDW(
+        WarnID.EmptyValueDelimiterPolicyWarning,
+        "dfdl:emptyValueDelimiterPolicy='%s' will be ignored as it's only 
implemented for 'both'",
+        emptyValueDelimiterPolicy
+      )
+    }
+  }
+
   /**
    * true if padding will be inserted for this delimited element when 
unparsing.
    */
diff --git 
a/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd 
b/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
index 4b481906d..719870bb2 100644
--- a/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
+++ b/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
@@ -736,6 +736,7 @@
           <xs:enumeration value="discouragedDiscriminatorPlacement" />
           <xs:enumeration value="discouragedAssertPlacement" />
           <xs:enumeration value="emptyElementParsePolicyError" />
+          <xs:enumeration value="emptyValueDelimiterPolicyWarning"/>
           <xs:enumeration value="encodingErrorPolicyError" />
           <xs:enumeration value="escapeSchemeRefUndefined" />
           <xs:enumeration value="expressionCompilationSkipped" />
diff --git 
a/daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml 
b/daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml
index 582738576..0ab4ea916 100644
--- 
a/daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml
+++ 
b/daffodil-test/src/test/resources/org/apache/daffodil/usertests/SepTests.tdml
@@ -609,4 +609,75 @@
     </tdml:infoset>
   </tdml:parserTestCase>
 
+  <tdml:defineSchema name="s7" elementFormDefault="unqualified">
+
+    <xs:include 
schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+    <dfdl:format
+      ref="ex:GeneralFormat"
+      emptyValueDelimiterPolicy="none"
+      lengthKind="delimited"
+      separatorPosition="infix"
+      separatorSuppressionPolicy="trailingEmpty"
+    />
+
+    <xs:element name="input">
+      <xs:complexType>
+        <xs:sequence
+          dfdl:separator=","
+          dfdl:separatorPosition="infix"
+          dfdl:separatorSuppressionPolicy="trailingEmpty">
+          <xs:element
+            name="FirstName"
+            type="xs:string"/>
+          <xs:element
+            name="MiddleName"
+            type="xs:string"
+            dfdl:initiator="("
+            dfdl:terminator=")"
+            dfdl:emptyValueDelimiterPolicy="none"/>
+          <xs:element
+            name="LastName"
+            type="xs:string"/>
+        </xs:sequence>
+      </xs:complexType>
+    </xs:element>
+  </tdml:defineSchema>
+
+  <tdml:parserTestCase name="test_sep_evdp_1" root="input" model="s7"
+    implementations="daffodil" roundTrip="onePass">
+    <tdml:document>
+      <tdml:documentPart type="text" 
replaceDFDLEntities="true">John,(),Doe</tdml:documentPart>
+    </tdml:document>
+    <tdml:infoset>
+      <tdml:dfdlInfoset>
+        <input>
+          <FirstName>John</FirstName>
+          <MiddleName></MiddleName>
+          <LastName>Doe</LastName>
+        </input>
+      </tdml:dfdlInfoset>
+    </tdml:infoset>
+    <tdml:warnings>
+      <tdml:warning>emptyValueDelimiterPolicyWarning</tdml:warning>
+      <tdml:warning>none</tdml:warning>
+      <tdml:warning>ignored</tdml:warning>
+      <tdml:warning>both</tdml:warning>
+    </tdml:warnings>
+  </tdml:parserTestCase>
+
+  <tdml:parserTestCase name="test_sep_evdp_2" root="input" model="s7"
+    implementations="daffodil">
+    <tdml:document>
+      <tdml:documentPart type="text" 
replaceDFDLEntities="true">John,,Doe</tdml:documentPart>
+    </tdml:document>
+    <tdml:infoset>
+      <tdml:dfdlInfoset>
+        <input>
+          <FirstName>John</FirstName>
+          <MiddleName></MiddleName>
+          <LastName>Doe</LastName>
+        </input>
+      </tdml:dfdlInfoset>
+    </tdml:infoset>
+  </tdml:parserTestCase>
 </tdml:testSuite>
diff --git 
a/daffodil-test/src/test/scala/org/apache/daffodil/usertests/TestSepTests.scala 
b/daffodil-test/src/test/scala/org/apache/daffodil/usertests/TestSepTests.scala
index aa7347813..3ffd03612 100644
--- 
a/daffodil-test/src/test/scala/org/apache/daffodil/usertests/TestSepTests.scala
+++ 
b/daffodil-test/src/test/scala/org/apache/daffodil/usertests/TestSepTests.scala
@@ -20,6 +20,7 @@ package org.apache.daffodil.usertests
 import org.apache.daffodil.junit.tdml.TdmlSuite
 import org.apache.daffodil.junit.tdml.TdmlTests
 
+import org.junit.Ignore
 import org.junit.Test
 
 object TestSepTests extends TdmlSuite {
@@ -48,6 +49,10 @@ class TestSepTests extends TdmlTests {
   @Test def test_sep_ssp_never_6 = test
   @Test def test_sep_ssp_never_7 = test
 
+  // DAFFODIL-2205 - EmptyValueDelimiterPolicy only works with 'both'
+  @Test def test_sep_evdp_1 = test
+  @Ignore @Test def test_sep_evdp_2 = test
+
   // DAFFODIL-2791
   @Test def test_treatAsAbsent_occursIndex = test
 }

Reply via email to