mbeckerle closed pull request #142: Fix incorrect diagnostic.
URL: https://github.com/apache/incubator-daffodil/pull/142
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesDelimiters.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesDelimiters.scala
index ac3f387c2..3570b8e68 100644
---
a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesDelimiters.scala
+++
b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesDelimiters.scala
@@ -92,35 +92,29 @@ abstract class StaticText(delim: String, e: Term, eb: Term,
kindString: String,
lazy val textParser = new TextParser(e.termRuntimeData)
}
-abstract class DelimiterText(e: Term, eb: Term, guard: Boolean = true)
+abstract class DelimiterText(e: Term, eb: Term, delimiterType:
DelimiterTextType.Type, guard: Boolean = true)
extends Text(e, eb, guard) {
lazy val textParser = new TextParser(e.termRuntimeData)
- def delimiterType: DelimiterTextType.Type
-
override lazy val parser: DaffodilParser = new
DelimiterTextParser(e.termRuntimeData, textParser, positionalInfo,
delimiterType)
override lazy val unparser: DaffodilUnparser = new
DelimiterTextUnparser(e.termRuntimeData, delimiterType)
}
-case class Initiator(e: Term) extends DelimiterText(e, e) {
+case class Initiator(e: Term) extends DelimiterText(e, e,
DelimiterTextType.Initiator) {
Assert.invariant(e.hasInitiator)
- val delimiterType: DelimiterTextType.Type = DelimiterTextType.Initiator
}
-case class SequenceSeparator(s: SequenceTermBase) extends DelimiterText(s, s,
s.hasSeparator) {
- val delimiterType: DelimiterTextType.Type = DelimiterTextType.Separator
-}
-case class Terminator(e: Term) extends DelimiterText(e, e) {
+case class SequenceSeparator(s: SequenceTermBase) extends DelimiterText(s, s,
DelimiterTextType.Separator, s.hasSeparator)
+
+case class Terminator(e: Term) extends DelimiterText(e, e,
DelimiterTextType.Terminator) {
Assert.invariant(e.hasTerminator)
- val delimiterType: DelimiterTextType.Type = DelimiterTextType.Terminator
}
abstract class StringDelimBase(e: Term, guard: Boolean) extends Terminal(e,
guard) {
override def toString = "StringDelimBase[" + name + "]"
- def checkDelimiterDistinctness(
- escapeSchemeKind: EscapeKind,
+ def checkDelimiterDistinctness(escapeSchemeKind: EscapeKind,
optPadChar: Option[String],
optEscChar: Option[String], // Could be a DFDL expression
optEscEscChar: Option[String], // Could be a DFDL expression
diff --git
a/daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes2.tdml
b/daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes2.tdml
new file mode 100644
index 000000000..a673eb5d2
--- /dev/null
+++
b/daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes2.tdml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<tdml:testSuite suiteName="SimpleTypes2" description="Section 5 - simple types"
+ xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ex="http://example.com" xmlns:tns="http://example.com"
+ defaultRoundTrip="true">
+
+ <tdml:defineSchema name="s">
+ <xs:include
schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+
+ <dfdl:format ref="ex:GeneralFormat" lengthKind="delimited"
representation="text" />
+
+ <xs:element name="r" type="xs:string" dfdl:terminator="AAAAA"/>
+
+ </tdml:defineSchema>
+
+ <tdml:parserTestCase name="terminatorErrorMessage" root="r"
+ model="s" description="Insure parse error about missing delimiter says
'terminator' when it is a terminator that is missing.">
+
+ <tdml:document><![CDATA[abcde]]></tdml:document>
+ <tdml:errors>
+ <tdml:error>Parse Error</tdml:error>
+ <tdml:error>terminator</tdml:error>
+ <tdml:error>AAAAA</tdml:error>
+ <tdml:error>not found</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+</tdml:testSuite>
diff --git
a/daffodil-test/src/test/scala/org/apache/daffodil/section05/simple_types/TestSimpleTypesNew.scala
b/daffodil-test/src/test/scala/org/apache/daffodil/section05/simple_types/TestSimpleTypesNew.scala
index f5e749949..3e59a251e 100644
---
a/daffodil-test/src/test/scala/org/apache/daffodil/section05/simple_types/TestSimpleTypesNew.scala
+++
b/daffodil-test/src/test/scala/org/apache/daffodil/section05/simple_types/TestSimpleTypesNew.scala
@@ -26,9 +26,11 @@ object TestSimpleTypesNew {
val runner = Runner(testDir, "SimpleTypes.tdml")
val runner1 = Runner(testDir, "BitOrder.tdml")
+ val runner2 = Runner(testDir, "SimpleTypes2.tdml")
@AfterClass def shutdown {
runner.reset
runner1.reset
+ runner2.reset
}
}
@@ -46,4 +48,7 @@ class TestSimpleTypesNew {
// DAFFODIL-1001 fixed.
@Test def test_bigEndianLeastFirst() {
runner1.runOneTest("bigEndianLeastFirst") }
+
+ // DAFFODIL-2204
+ @Test def test_terminatorErrorMessage() {
runner2.runOneTest("terminatorErrorMessage") }
}
diff --git a/eclipse-projects/tdml-test/.project
b/eclipse-projects/tdml-test/.project
index 8972d1fa7..a46ed36b4 100644
--- a/eclipse-projects/tdml-test/.project
+++ b/eclipse-projects/tdml-test/.project
@@ -29,7 +29,7 @@
<link>
<name>src/test</name>
<type>2</type>
-
<locationURI>DAFFODIL_ROOT/daffodil-tdml/src/test</locationURI>
+
<locationURI>DAFFODIL_ROOT/daffodil-tdml-lib/src/test</locationURI>
</link>
</linkedResources>
</projectDescription>
----------------------------------------------------------------
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