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


##########
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:
   But if the charset evaluates to EBCDIC at runtime we'll still use 
textZonedSignStyle. So in that case we still need the property at compile time 
(like you have) but we need to ignore it at runtime.
   
   So maybe the parser/unparsers need to have the charsetEv passed in, and if 
at runtime if it's non-constant and evaluates to EBCDIC then it ignores 
`optTextZonedSignStyle`?



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