mbeckerle commented on code in PR #1149:
URL: https://github.com/apache/daffodil/pull/1149#discussion_r1460997049


##########
daffodil-core/src/main/scala/org/apache/daffodil/core/grammar/ElementBaseGrammarMixin.scala:
##########
@@ -700,6 +701,30 @@ trait ElementBaseGrammarMixin
       ConvertZonedCombinator(this, stringValue, textZonedConverter)
     }
 
+  /**
+   * True if the encoding is known to be an EBCDIC one, as in the encoding is 
not  a runtime expression
+   * and it's some ebcdic flavor. If it's any ascii flavor or a runtime 
expression this is false.
+   */
+  lazy val isKnownEBCDICEncoding: Boolean = {
+    charsetEv.optConstant
+      .map { bcs: BitsCharset =>
+        val nom = bcs.name.toUpperCase()
+        val res = (nom == "IBM037") ||
+          nom.startsWith("EBCDIC")
+        res
+      }
+      .getOrElse(false)
+  }
+
+  /**
+   * Avoids requesting the textZonedSignStyle property if we know the encoding
+   * is an EBCDIC flavor.
+   */
+  lazy val optTextZonedSignStyle = {
+    if (isKnownEBCDICEncoding) None
+    else Some(textZonedSignStyle)
+  }

Review Comment:
   Correct. That is what happens. So this optional thing is just about not 
reqiring what is an ascii-oriented property at all in the case where it is 
known for certain to be EBCDIC.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to