mbeckerle commented on a change in pull request #88: Daffodil 1919 separators
URL: https://github.com/apache/incubator-daffodil/pull/88#discussion_r208998370
 
 

 ##########
 File path: 
daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLAssertion.scala
 ##########
 @@ -55,28 +57,41 @@ abstract class DFDLAssertionBase(node: Node, decl: 
AnnotatedSchemaComponent)
 
   private lazy val testPattern = {
     val optPattern = getAttributeOption("testPattern")
-    if (optPattern.isDefined) {
-      val thePattern = optPattern.get
-
+    optPattern.foreach { thePattern =>
       try {
         // val icu =
         UnicodeRegex.compile(thePattern) // Check against ICU
         // val java =
         Pattern.compile(thePattern) // Check against Java
       } catch { case e: PatternSyntaxException => SDE("The pattern contained 
invalid syntax: %s", e.getMessage()) }
+    }
+    optPattern
+  }
+
+  /**
+   * This assertion can appear on a global element def, for example, which is
+   * not a term, and so we cannot ask it for properties and get all the 
properties
+   * in the scope.
+   *
+   * To avoid reaching backward from a global element decl to the element ref
+   * that is the start of the property assembling for that term, we instead 
call
+   * from a term to its statements, passing them the Term they need to verify
+   * that they are compatible with the properties of that term.
+   *
+   * This is a technique to avoid backpointers from shared definitions/decls to
+   * the referencing objects that refer to them.
+   */
+  private def checkPattern(term: Term) = {
+
+    if (testPattern.isDefined) {
+      val thePattern = testPattern.get
 
 Review comment:
   Done

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to